If you are installing a standby generator on-premises with a mains power supply, it is a legal requirement to have a transfer switch. This can be either manual or automatic. This avoids the mains power burning out the generator which would be almost certain to happen if the mains power came back on while the generator was running, and it avoids the generator back-feeding the mains which would endanger the safety of the electricity utility workers.
Both types of switches perform the same function, but the automatic transfer switch obviously does it automatically, saving time and restoring power almost immediately. Furthermore, if you have a manual switch, it means that you have to be on the premises in order to start the generator, so if you are away there will be no power until you return and switch over.
There are two types of automatic transfer switches, or ATS, panels. One has mains detection built-in and monitors the mains supply. When it detects a mains failure it will send a signal to the generator to start. When the generator has started it then sends a signal back to the ATS saying that it is available, and the ATS will then switch to the generator.
If the ATS does not have mains detection built-in, this will have to be part of the generator and it will monitor the mains supply. When it detects the mains failure it will send a signal to the ATS to disconnect from the mains and start itself automatically. As soon as it is up and running it then sends a signal to the ATS telling it to switch to the generator.
There are a number of different designs of ATS panels, but usually, a mains failure relay is fitted with two contactors in an enclosure. The contactors are mechanically and electrically interlocked, and a mechanical device called an interlock ensures that the two contactors cannot be closed at the same time. If you have two contactors, A and B, the circuit to close contactor A is wired through the auxiliary of B, therefore when B is closed, it is not possible to energize A. The same is true for B which is wired through the auxiliary of A. This provides the electrical interlock.
When the mains fails and the generator starts, the ATS opens the mains contactor and closes the generator contactor. When mains power is restored, the reverse happens. Since the two contactors can never be closed together, there is always a short break in the supply as the contactors change over.