Magnetos are like generators in that they convert mechanical energy into electrical energy. But they differ because the electrical energy is not continuous -- instead delivered in periodic, brief sparks. Magnetos are used to deliver power to the spark plugs in small engines like those in lawn mowers and dirt bikes. They work by moving a permanent magnet rapidly past a coil, inducing a current into the coil. The coil stores the energy in a magnetic field -- sometimes supplemented by a capacitor -- until the circuit is suddenly broken, which produces a large spark.
Attach the permanent magnets to a part of the machine that is rotating, such as the flywheel. They must be attached to something that moves, because when magnets move rapidly past the coils, this generates the electricity converted into a pulse. This is why you need to use a pull cord to start some small engines. You must get the magnets spinning past the coil to start sending pulses to the spark plugs. Once the engine starts, the magneto will keep producing sparks.
Wind two coils. Typical numbers are 2,000 turns for the primary coil -- the one nearest the permanent magnet, and 200,000 turns for the secondary coil -- the one that connects to the spark plug. The coils will produce stronger magnetic fields, and therefore bigger pluses, if wrapped around the same iron core. In automobiles, this iron core is a single rod. On lawnmowers, boat motors and dirt bikes, the coils are usually wound on a U-shaped or V-shaped core.
Wire a capacitor and a set of contacts in a loop with the primary coil. Connect the secondary winding to the spark plug. As the magnets rotate past the primary coil and induce electricity in the coil, the electrons pile up on the plates of the capacitor. The back and forth interplay between stored electrons on the capacitor plates and the energy stored in the magnetic field is suddenly released when the contacts open. This induces a spike in the secondary coil. Because the secondary coil has more windings, it amplifies the spark that goes to the spark plug.
The primary coil must be close to the rotating magnet. The secondary one shares a core with the primary coil, but it does not need to be near the rotating magnet.
The thinner the wire is, the more turns you can get on the core. To keep winding wires thin, you should use enameled wire. Be careful winding enamel coated wire. A nick or scratch can cause a short circuit and reduce the effectiveness of the coil.