What’s the difference between sensei and kyōshi?

Japanese has (at least) two words for "teacher".

The word "sensei" is pretty well-known even among people who don't speak Japanese, but did you know that you shouldn't use sensei about yourself?

Here's what the textbook has to say:
"Use 'kyōshi' for yourself and the respectful 'sensei' for another person."
That's a pretty good starting point. But there's a bit more to it than that.

1. Kyōshi = school teacher

Kyōshi means the academic kind of teacher, someone who teaches in a school:
(watashi wa) kōkō no kyōshi desu.
I'm a high school teacher.

Images: Irasutoya

2. Sensei is a title

Sensei, however, is a respectful title, and should be used when talking about other people:
kare wa chūgakkō no sensei desu.
He's a junior high school teacher.
Watashi wa sensei desu is best avoided.

3. Sensei = master

Sensei can also be used more generally for a person who teaches something.

People who teach flower arranging or martial arts, for example, are sensei:

ohana no sensei
flower-arranging teacher
karate no sensei
karate teacher
sadō no sensei
teacher of tea ceremony
If you're talking about yourself, however, you still shouldn't go around calling yourself sensei. You can use the verb 教える oshieru (to teach) instead:
(watashi wa) ohana wo oshiete imasu. 
I teach flower arranging.
Certain types of professionals such as doctors or lawyers are also sensei (but again, not kyōshi).

4. "Sensei!"

Sensei is attached after teachers' names instead of san:

Yamamoto Sensei
= Mr/Ms Yamamoto; “Yamamoto teacher”
It's pretty common to drop the name, too, and just call your teacher sensei:

Sensei, ohayō gozaimasu!
“Good morning, teacher”

But you can’t call your teacher Yamamoto Kyōshi or greet them with “kyōshi, ohayō gozaimasu”... unless you want them to think you're a bit strange.

Related: Hey! What's That お Doing There?