The primary node and secondary node send heartbeats to each other to detect if its peers are alive. If the primary node is not accessible, such as during a reboot, a failover occurs. You can also configure a ping server to regularly check the unit's network condition and downgrade itself to secondary type to trigger a failover. In a failover, the secondary and primary switch roles and the cluster IP addresses change, as indicated by the boxes in the lower image.
In a cluster, there is only one copy of a job, which is in the unit that the primary assigned it to. Jobs that are assigned to the "old" primary will not be scanned in another cluster unit after failover.