How do iPads detect when a cover closes?
The Smart Cover has a magnet that interacts with the sleep sensor of an iPad. So whenever you close the Smart Cover, iPad will know when to sleep. The same theory for waking up.

Info from MacRumors