Relays / Contactors are nothing more than a switch. In heating and cooling these relay/contactors are used to turn on high voltage components such as motors, compressors, and other high voltage components.
When a thermostat reaches a set temperature. A transformer, usually 24 volts, energizes the contactor which has a coil built into it. When the coil is energized it acts like a magnet and pulls the legs of the contactor down making contact on both sides completing a circuit. When there is no voltage from the transformer the coil lets go of the legs opening the circuit.
This allows a thermostat to control all the high voltage components in a HVAC system with only 24 volts.
Contactors come in three styles single pole, double pole, and triple pole.
Contactor on Amazon
Carrier Single Pole / 1 Pole 30 Amp Replacement Condenser Contactor HN51KB024
The picture above is a single pole 40 AMP contactor. The end leads will have AC voltage from a breaker or disconnect fed into one side, such as 120/220 volts, and will always be hot. The other side will only be hot when engaged. The legs on the side are for the transformer to connect to and feed 24 volts AC to activate it when necessary.
HVAC contactors can be pressed down manually completing the circuit and is often used to test them in the field. A plastic cover with small screws will need to be removed to press down on one.
Another way to test one is to see if voltage is going from one side to the other. AC voltage from a fuse box will go into one side and always be hot. The other side will only have voltage when the contactor is engaged and working. Measuring both sides with a multi meter should give the same voltage when it is on.
The third way to test a contractor (with the power off) is to check for continuity when it is engaged by the transformer.
A common problem with a bad contactor is pits and scaring builds up where the legs touch. This can be seen by black burn marks and pitting. Also always check the voltage from the transformer for the correct voltage. A bad transformer not sending out the correct voltage will never let the transformer switch on.
Here is a good video describing how a contactor works.