Ken here is a simple explanation for the why and where to use relays. Relays are often used for two reasons.
Reason one is that relays often have large contacts that can handle large currents, and be controlled by switches or micro controllers that can only handle small currents.
Think large currents (a lot of amps) will require large wires to safely carry that current. Small currents can be safely handled by little bitty wires. So by using a small switch or an electronic module of some kind that can only deal with small currents to control a relay that can handle large currents you now have an easy method to control those large currents and still have small switches or microprocessors doing the controlling.
OK, now on two the second reason. The second reason is controlling large currents from a remote location. Instead of bringing large wires back to a switch that is rated for large currents for example back into your cab then back out to where the current is needed, why not put a relay out on the firewall to control those large currents? Lets control if from a little switch or micro controller located somewhere else remotely.
The benefits are you save on the amount of large wire, you save on having to have a large switch rated to control that much current and you save on the losses of running the large wire long distances instead of a short distance.
Furthermore in the case of the Micro controllers there is not a good way to make them able to even handle those large currents at all.
Now for a simple explanation of how the relay works inside. The relay has a coil of very small wire inside that when a very small current is passed through this wire it makes a magnetic field.. In other words it is an electromagnet. The magnet that is created when current is flowing is near a piece of steel called the pole piece. Attached to this piece of steel is a moving copper contact to carry high currents. There is also a non moving copper contact to mate with the moving contact to carry this current on and out of the relay body.
When the magnet attracts the piece of steel and attached moving copper contact, it moves toward the fixed contact and they mate together and the high current flows through these contacts.
When the small coil current is removed by the switch or micro controller the coil is no longer magnetic and the steel pole piece moves back to the relaxed position by pressure from a small spring. When the relay is energized by the coil, it has enough power to overpower the small return spring pressure.
Now you know how relays work inside, and a couple of reasons to use them
James K0UA