Our brains are wired to pay the most attention to the most basic survival conditions:
Will it eat me? Can I eat it?
Will it mate with me? Can I mate with it?
Have I seen this before? (your brain is looking to associate it with a pattern it might be familiar with)
We also pay better attention to things when we first know the big picture. When teaching a class, you are best to start off explaining what is to come and why. Then the brain will have an easier time paying attention to and understanding the details.
The brain's attention span is also about 10 minutes long. At the 10 minute mark your best bet is to segue into another related topic. It is also a good idea to throw in something humorous to break the monotony of the previous 10 minutes.