The root bridge is elected based on the switch that has the lowest advertised Bridge ID in the switches’ BPDUs.