UZ
A persistent connection is maintained from the Agent to the parent (MS or GW) over the MOMChannel (tcp_5723). If this channel is interrupted – then the agent will start a failover.
The Agent will look in the agent’s local config file (OpsMgrConnector.Config.xml) to get parents. Then use a random algorithm to pick one, and attempt a connection. If this is unavailable, it will randomly select another one from the remaining management servers, repeating indefinitely.
In the Config file, under <Parents> XML heading - all management servers will show up by default - with one being set to <IsPrimary>True</IsPrimary>. During a failover, the agent will chose from all remaining management servers in the list, randomly. Once an agent connects to another parent, it will also attempt to connect back to the Primary on a set schedule, and once it can reconnect to its primary, it will fail back.
This assumes we are not using AD Integration for agent assignment, and assumes the customer has not modified the Agent using the SDK for Primary and Failover List.