In the STP root bridge election process, all of the switches advertise themselves as the root bridge until they receive a superior BPDU. Every source about STP says that after initialisation all of the ports start in the Blocking state. If the ports are in blocking state, which means they cant forward any frames, how can the switches forward their bridge id in order for the root bridge election process to happen?
Because Blocked means blocked to user frames. From wikipedia:
The purpose of STP is to avoid loops in the network, by blocking links that would form a loop. This means blocking frames destined for hosts.
BPDU frames can still be received by a port in the block state.
The root bridge election process occurs when the ports are in the listening state. after the default time the ports will transition from blocking to listening, then they would be able to send and receive BPDUs, in order to advertise themselves as the root bridge