What type of power supply is this and how does it work?
It is a capacitive power supply with a half-wave rectifier. Most of the grid voltage is dropped on the capacitor due to its impedance. The rest is rectified and regulated using a Zener diode. 

You must be careful when using this kind of power supply because it is not isolating the grid from low voltage side. Also remember that special (X-rated) capacitor is needed in order to provide minimum security.