Think of a relay as an electrically operated switch. An electromagnet closes a switch. When the electromagnet is powered, the switch closes and turns something on. When the electromagnet is not powered, the switch opens and turns something off. Relays are usually used to turn higher-voltage circuits on and off. For example, if I want my microcontroller (which runs on 5v DC) to switch on my lights (which run on 120v AC), I can use a relay. The microcontroller powers the coil, which closes the switch and turns on the light. Another added benefit is there is no common point between the low-voltage circuit and the high-voltage circuit, so there's not much chance of harming the microcontroller.