After you turn the ignition off, the electric fan doesn't stop spinning immediately. For the 10 or so seconds it is still spinning, the fan itself is acting as a generator, feeding energy back up to your ignition system.
This
Cartalk Puzzler explains in more detail.