How Magnets Generate Electricity