How it works
A relay is an electromechanical switch that allows a low-power circuit to control a completely separate high-power circuit. It contains a small electromagnet coil. When a small current energizes the coil, the magnetic field physically pulls a set of mechanical switch contacts closed (or open).
Relays provide total electrical isolation (galvanic isolation) between the control circuit and the load. This allows a delicate 5V microcontroller pin to safely turn on a 120V AC appliance without any direct electrical connection between the two systems.