A relay is an electromagnet with an internal spring-loaded lever to switch electrical contacts. To energise the relay, alternating current (AC) or direct current (DC) is passed through the coil of the electromagnet, magnetising the core to attract the lever. By this means, a small current applied to the coil will switch a large electrical current in the contacts. This current may be from another switch, the circuit board the relay is on, or another electrical circuit.
The starter on a car has a combination solenoid and relay. A relatively small current from the key switch activates the relay to direct the large battery current to the starter motor. Low current on the furnace control circuit board uses a relay to engage the high current fan motor. Street lights use a photo cell to activate a relay, and the relay turns on and off the high current of the street light.
Direct current (DC) is steady and never reverses. A DC relay uses a single coil of wire wound around the iron core to make the electromagnet. When the DC coil is energised, the magnetism generated in the core is steady because the DC just keeps going. The steady magnetism keeps the lever attracted as long as the DC is flowing. Once the current is turned off and the iron core is no longer magnetised, the spring-loaded lever returns to a relaxed position and the electrical contacts are switched back.
Alternating current (AC) never stays the same and keeps reversing direction. When AC flows, it climbs to a peak and then drops back to 0 in order to reverse direction. Then the current climbs to a peak and drops to 0 again to go forward again. Each time the current reaches a peak, it falls back to 0 so it can change direction. The cycle of going back and forth repeats 50 or 60 times a second, and the magnetism in the core, being generated by the current in the coil, also follows in this back and forth cycle.
In a DC relay, when the current stops and the magnetism in the core falls to 0, the spring-loaded lever starts to pull back to the relaxed position. If AC is applied, the lever doesn't go very far because the core becomes magnetised and attracts the lever again. This cycle of releasing the lever and pulling it back is repeated each time the AC reverses and the relay sounds like it's buzzing, or chattering. Sometimes the electrical contacts may not even switch correctly.
To prevent this chatter, the AC relay has two coils to make a transformer to keep the core magnetised. The wire of the traditional coil is the transformer primary. The secondary of the transformer looks like a D-shaped copper washer or ring. Some of the magnetism from the primary coil produces current inside the copper ring. The current in the ring, or transformer secondary, is actually delayed compared to the current in the primary coil to keep the core always partially magnetised. The lever won't chatter against the core because, while the AC is flowing, the continuously magnetised core never releases it.