A relay is an electrically operated switch.
Relays can be used as switches or amplifiers.
Relays act as a bridge by making use of low currents to activate circuits with high current (where appliances or machines are connected).
There are two types of relays:
Electromechanical relays: Contacts are closed or opened by a magnetic force.
Solid state relays: Having electronic parts with no mechanical contacts.

Electromechanical relays

Solid state relays
Commonly have 4 parts: Electromagnet, Armature, Spring and Set of Electrical Contacts.
When DC passes through the relay's input circuit, the electromagnet gets excited and attracts the metal bar (a moving armature) towards the stationary contact. This closes the circuit and activates the high-current appliance.
Electromechanical force is used by these types of relays to control an electric circuit, hence the name.
Commonly have 6 (non-moving) parts: Resistor, LED, Photocoupler, Capacitor, Power transistor, Power MOSFET (not shown in image).
Lower current input passes through the LED and it emits light. This light is captured by a light sensor which actuates the transistor in the higher electric circuit. Once the transistor is actuated, the circuit closes and the appliance or machine is powered.
These types of relays use signals to make or break contact in an electrical circuit.
Some relays are used with thermostats (senses temperature), pressure switches (senses pressure), etc.

1.Input Circuit 2. LED 3. Light Sensor 4.Transistor 5.Trigger Circuit 6.High-Current Appliance

1. Input Circuit 2. Electromagnet 3. Metal bar 4. High-Current Appliance
Kind of electric lever: Switch on the relay with a small electric current and the relay will turn on the other appliances using a bigger electric current.
For example: A refrigerator's compressor keeps the interior cold. Most refrigerators have a thermostat with 4 wires. One wire supplies 24V AC power to the thermostat and the other three carry control signals. When the temperature inside the refrigerator deviates from the set point, the thermostat sends a signal to the relay switch to start or stop the compressor. Thus, a low current controls a high-current compressor.
Relays protect an electronic device from various faults like circuit failure, overload, or system failure.
Relays are widely used to control motors, high-power industrial lamps, heaters, AC circuits, automobiles, industrial automation machines, and military equipment.