After stepdown finishes, the primary sends a replSetStepUp command to a caught-up candidate. If there is more than one viable candidate whose last applied optime is the same as the primary’s, a candidate with the highest priority will be chosen. If that still ties, the node with the lowest index in config.members is chosen. The replSetStepUp command is scheduled to be sent immediately and stepdown doesn’t wait for the response of replSetStepUp command before returning to the user. The chosen secondary will start an election immediately without waiting for the election timeout.