This happens to me quite a bit in Civics.
The teacher is a loud, old guy who really likes to go off on tangents from his lectures about the government. He'll be talking about Obama's political ideas, then 20 minutes later, will somehow end up talking about the California gold rush.
Anyway, he doesn't involve the class in any of his lectures what so ever, so I'm free to doodle. I start doodling, then I start daydreaming. Eventually, I look at the clock and notice that there's 5 minutes left of class. Strangely, I can't seem to remember anything about what I was daydreaming about after the whole <insert daydream topic> idea.
It is pretty relaxing. :D