Relays - simply intelligent switches
A relay is, roughly speaking, an electromagnetic switch. It is switched by one or more control signals and is used in places where it is necessary to control a circuit by an independent signal of low power.
The traditional form of a relay uses an electromagnet for control, which opens or closes the contacts of the main circuit. Thus, a relay operates with a separate control and main circuit.
The technology behind it is as simple as it is ingenious: the switch consists of a coil with an iron core. When current flows through this coil, an electromagnetic magnetic field builds up. This attracts the so-called armature - the circuit closes.
In microelectronics, relays are usually controlled by a simple input signal. The low current of the microcontroller is sufficient here with a "HIGH" or "LOW" signal to switch the relay.