Relay as the name defines itself "receive and pass on", an electrical device, typically incorporating an electromagnet, which is activated by a current or signal in one circuit to open or close another circuit.
A relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate a switch, but other operating principles are also used, such as solid-state relays.
Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits).
For more information about Relays check out this link.
In our case here the low-power signal is the output signal(typically 5 volts) from the microcontroller which is used to control the switch which is operating at 220 volts AC.
A typical 5v/220v relay consists of an input terminal to which the input from the microcontroller is to be given and an output terminal to which the device which has to be controlled is connected.
There are two ways in which a relay's output terminal can be connected to a switch
1. Connecting Relay in parallel to a switch.
This is done by connecting the NO(normally open) and Common terminals of the relay to the two terminals of the switch. This type of connection ensures that the switch can be operated independently by either of two ways, i.e either manually or through the remote.
This provides an advantage that the switch can be operated manually even when the circuit is not working.
2. Connecting Relay in series with the switch.
This is done by connecting the NO(normally open) terminal to device and common to one terminal of the switch and other terminal of switch to the supply. This type of connection ensures that the switch is high only when it is both manually switched on and also through the remote.