In short
A sense of humour in a teacher always goes down well with students - it can be a useful tool for behaviour management as well as making you a popular educator.
The use of repartee and dry wit can defuse situations where students are misbehaving and enable you to go back and deal with the issue later, in a quiet and controlled manner.
You can be proactive as well as reactionary - keeping the humour levels up can ensure that students are engaged and in a positive frame of mind.
You have to be careful not to slip into sarcasm, as that can be damaging.
Humour also helps the teacher to control their own behaviour, especially in terms of reducing stress.