The capacitor has reactive impedance (1/(2*Pi*f*C), so ultimately acts as a voltage divider with the other series resistors and LED. The resistor across it discharges it when the mains is removed. A special class of capacitors (look up X2 and Y2 capacitors)) must be used in this type of application, and the circuit is inherently extremely dangerous, as there is no isolation between the mains input and DC output. If the capacitor fails short, examine the circuit and figure out what the consequences might be, which is a standard procedure when testing circuits to gain standards approval,
cheers,
Richard