A car horn is (well, it was before the age of electronic devices) a very simple electromechanical device that uses the principle of electromagnetism to create noise.
A typical car horn consists of a flexible metal diaphram (usually made of spring steel), a coil of wire that forms an electromagnet, a switch and a housing that functions somewhat like a megaphone. The entire apparatus functions according to Hooke's Law, which states, "The extension of a spring is directly proportional to the load applied, provided the limit of proportionality is not exceeded."
This is fancy wording that means, simply, that if you design the horn properly the flexible diaphram will oscillate back and forth continuously as long as current is applied. This will translate into the sound desired.
Horns are constructed with a flexible electrical contact that is attached to — or actuated by — the flexible diaphram. A strong electromagnet that moves a central armature is connected to the flexible metal diaphragm. When current is applied to the electromagnet the armature moves to its mechanical limit, momentarily disconnecting power. As it relaxes back to its starting point, electrical contact is again made and the armature starts its travel again.
As you might imagine, moving all this mass to create a loud, sustained sound that is often in excess of 90 decibels in loudness takes a lot of energy. That energy is electrical current, of course, and in cars equipped with electromechanical horns the only accessory that uses more is the starter. Headlights, power seats, etc., individually don't use as much current as the horns. That's why the wiring and terminals associated with horns are so large, and also why a relay is necessary to actuate the horns.
In actual operation, one presses the horn button and at that moment the electrical contact allows current flow to the relay, which in turn furnishes high current to the horn's electromagnet. That, in turn, attracts the diaphragm, which flexes to its mechanical limit. This disengages the contact, which stops current flow to the electromagnet. The diaphram is released to travel back past neutral position closing the switch again, and thereby pulling the diaphragm back, setting up an even oscillation.
Horns come in an endless variety of notes, or frequencies. The note of a horn is determined by the flexibility of the diaphram; its physical size; the power of the electromagnet; the mass of the diaphram; mechanical arrangement of the switch contact; size and shape of the horn's case and a number of other contributing factors.
Most collector cars (those made before the 1970s, anyway) have two horns, a low-note and a high-note. The combination of these two notes is what gives the distinctive sound of a particular car. Interestingly, larger cars always were equipped with horns that gave an overall lower frequency honk and small car horns were biased toward the higher frequencies. Hence the "beep-beep" of Volkswagens and the French-horn type sounds from Cadillacs.
Believe it or not, many countries mandated (and still do) a car's specific horn frequency. The idea is that a high-pitched horn note should indicate a small vehicle and the lower the note the larger the vehicle. That's why big trucks have such deep horn sounds and locomotives, well...