Keeping things interesting seems to help motivate students to some degree. If there’s a reason to come to class, if the material being taught relates to your life (the nefarious ways data is misunderstood/manipulated can be a draw, even in PSY 265).
Participation seems to be motivating, especially when students are asked to find strong reasons to disagree with the material – in class, via email (works well for the retiring and those not comfortable in English), or other means. In general, it keeps classes lively, more engaged, and the students make friends, even gossip, with more joining in over time. Failure and mistakes (including by the professor), when actively encouraged and described as being the bedrock of science, does help, particularly when a wrong well-argued argument is described as superior to a guessed correct one. Discussions about celebrities of some standing – Nobel laureates, Guggenheim Fellows, Spelling Bee winners, etc. – and how they are no different from our students seems to help, especially if their self-admitted foibles and mistakes come up.
After some participation, students do forget themselves and pitch in, especially if their curiosity is aroused. A few students say they changed their majors after coming across intriguing material. That is really encouraging.
In one class, when we used an example of a professor racing against Usain Bolt, and students started joking about putting out T-shirts showing that. We agreed it would be a good idea, because that way the material would be remembered years later. That is perhaps my ultimate cause for motivating students.