How does this RC circuit in a fan regulator work?
The schematic is poorly drawn, if you would connect a fan to the red and black wires then the fan can never run as it receives no power.
Assuming this circuit is in series with the fan and that series combination is connected to AC mains voltage, then the relays either make:

a direct connection between the red and black wires, the fan will run at full speed.

or

connect the left circuit (R1, R2, C2)

and/ or

the right circuit (R3, R4, C2)

in series with the fan.
R2 and R4 are only 2.2 ohms so these don't do much (you can consider them a short). Probably R2 and R4 are added to limit the current when the capacitors are discharged and the mains voltage is applied.
R1 and R3 have a high value, they are there to discharge the capacitors C1 and C2 when everything is switched off.
C1 has a value of 2.2 uF and C2 is 3.3 uF. These capacitors are connected in series* with the fan. These capacitors have a certain impedance (similar to resistance) at the mains frequency. A larger capacitor (C2) will have a lower impedance. The impedance of these capacitors is in series with the fan and that makes the fan run slower.
All waveforms remain sinusoids as these RC circuits are linear, they do not switch.