When switches first power on, each one assumes it is the root bridge. It sends BPDUs claiming itself as root. As switches receive BPDUs from neighbors, they compare Bridge IDs. The switch with the lowest Bridge ID becomes the root bridge. All other switches update their BPDUs to advertise this new root. The root bridge sits at the top of the spanning tree. Every other switch calculates its shortest path toward the root. If you don't configure priorities, the switch with the lowest MAC wins by accident.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/network-design/spanning-tree-and-link-aggregation/root-bridge-election
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████████████████████████████████████████████████████████████████████████████████████████████████