See also anacrusis.
This works on a simple principle of physics. A vibrating metal object (the electric guitar string) moving in a magnetic field creates an electronic signal that can be sensed by a wire coil. So the electromagnet of the pickup can sense the frequency of the vibrations of the strings and convert them into electrical signals that travel through a cable to the amplifier to increase and or alter the sound. (This same principal is the basis for electric motors, generators, phonograph needles, and accoustical speakers.)
Pickups for electric guitars and electric basses were being developed in the 1920's. The early pickups were designed to amplify the natural sound of the acoustic instruments and used the bridge of the instrument to move the vibrations to the electromagnet, but the signal was often too weak to be effective. When engineers utilized a direct pickup system, in which the electromagnet received the string vibration from the strings themselves, the modern electric guitars became a reality.
By 1961 the electric guitar was in it's full maturity and pickups were created in single-coil and double-coil, or humbucking designs. Gibson introduced "Humbucking" pickups into the Les Paul electric guitar, and was designed to eliminate unwanted hum from the magnetic coils. Humbucking pickups utilized two coils wrapped out of phase so as to cancel out the common mode hum introduced by previous designs.