Ego is an indication of individual identity. This means that one is different from the rest. Thus, it makes you stand out as an individual apart from the rest of the world.
Ego is obviously a part of interacting with the rest of the world. Only when one has ego, one can interact with the rest of the world. Thus, when one is teaching Yoga, he/she is teaching it to the students and the identity of a teacher as an individual has to be present. In that sense, a teacher must possess ego. Not only that, but the teacher should demonstrate sufficient ego as a teacher so that the teaching become effective. In this case, a lack of ego can mean ineffective teaching or even a failure due to the inability to discipline the students, etc.
However, when a teacher is successful, it is possible that others may think that a given teacher knows everything, or a given teacher has some miraculous powers, and such other exaggerative things. When teacher is experiencing such honours, a teacher may in fact develop his/her confidence in teaching. This is a good sign. However, when teacher actually starts thinking that he/she really knows everything, or he/she is truly enlightened, or he/she is really above the rest of the world, then the danger starts approaching such a teacher and also the world teacher is interacting with. Such a teacher then stops obtaining the knowledge, or stops performing the practice, and slowly starts slipping from the Yogic path. Eventually, such a teacher may stay at a given level of progress or may even degenerate into a lower level individual. Thus, the ego needs to be curbed in this case.
What should a teacher do? A teacher should never stop his/her own Yoga study/practice till the end of life. This takes him/her towards the final goal of Yoga, and if he/she reaches that goal, he or she sets a great example for others. This is called Lokasangraha in Srimad Bhagavadgita. And, teacher should always attribute the success to some higher entity such as guru and god. And lastly, the teacher should be polite to the students outside the classroom.