Knowing your material comes form age, wisdom and experience. After 30 years, I still need to update my skills and prepare as if the class is brand new and I am teaching it for the first time.
This process keeps you sharp and prevents the rote and boring lecturing. Positive preparation, as I call it, is necessary to make each and every class exciting and interesting.
Remember, it is the the student's class.