In undergraduate seminars or discussions, the trick is to be prepared for surprise and to use what students say to encourage further thinking and discussion. Quite often undergraduate perspectives on problems will be fresh and important, and worthy of development or challenge by the entire group. In such cases, I abandon my own carefully wrought plans, especially if such occurrences hold promise of stimulating student growth. Graduate students are easy to teach. First, some historical knowledge, a body of learning, and the skill and confidence to gain knowledge on their own.
Good teaching liberates students from their teachers after all.
Second, I hope that students' imaginations will be stretched and their natural curiosity nourished. Third, that they will grow intellectually and morally. The act of study and the process of learning should instill, one hopes, discipline and honesty. These are moral qualities. It takes a lot of ego to teach, but ego should not turn into egotism.