Hi Carl,
When any switch initialises/ introduced to a new network, they assume themselves as root and start transmitting BPDUs.
From the neighboring switch also, they receive BPDU, which may have a better information regarding the root bridge.
The switch then uses the information contained in the received BPDU to make decision/understand the topology of the network/elect a bridge as root.
-VJ