We talked about guitar pickups and how they work. It has to do with electromagnetic induction, which says that when there’s a change in the magnetic flux through a coil of wire a current will be induced in the wire.
The little disks under an electric guitar’s strings are magnets. Each pickup has a magnet under each of the strings. (Just for the record, there are different kinds of pickups that don’t look like this, but what we’re describing is the most common kind.) Inside the pickup, there’s a wire coil around the magnets. This wire coil is connected (after going through the tone and volume knobs) to the output socket, which you connect to the amp.
Since the strings are steel, each string becomes magnetized due to the permanent magnet under it. When you pluck the string it oscillates from its original position. Since it’s magnetized, the magnetic field through the wire coil involves both the string and the magnet, and so the string’s oscillation changes the magnetic field inside the coil. (Up above we’ve represented the magnetic field with a blue shape, rather than drawing field lines.) These changes in the magnetic flux cause electrical current to go back and forth in the wire. This signal ends up at the amp and speaker, where it becomes sound waves.
Ever wondered why you don’t have to plug in an electric guitar? It makes its own electricity.