A relay is a switch controlled by electricity. A small control signal can turn another circuit on or off, often with electrical isolation between the control side and the switched side.
Where relays are used
Relays are used in cars, appliances, industrial controls, alarms, power systems, and hobby electronics. They are useful when a small circuit needs to control a higher-voltage or higher-current load.
Relay versus transistor
A transistor can also switch loads, but a relay is mechanical or electromechanical and can provide physical isolation. Transistors are usually faster and more compact.
A relay is best understood as a switch that another circuit can flip for you.