The components you mention combine to form a simple transformerless supply for the IC. These are quite common in such circuits.
The 470nF capacitor and 500Ω present a set impedance to the mains voltage and limit the current. The reason a single resistor is not used is because it would have to dissipate a fair bit of power to do this, whereas a capacitor does not dissipate any power (or very little for a non-ideal cap)
We can demonstrate this by looking at the numbers:
Assuming a mains frequency of 50Hz, we can calculate the capacitor impedance:
\$ \dfrac{1} {2 \pi \times 470nF \times 50Hz} = 6772.5 \Omega \$
To work out the total impedance, we do:
\$ \sqrt{6772.5^2 + 500^2} = 6791\Omega \$
So the peak current through the 470nF capacitor and 500Ω resistor will be:
\$ \dfrac{311}{6791\Omega} = 45.8mA \$
RMS current will be \$ 45.8mA \times 0.707 = 32.4mA \$
The resistor will therefore dissipate:
\$({32.4mA})^2 \times 500\Omega = 520mW\$ - not too much, a 1W or 2W resistor will handle this okay.
Say we had just used a 6791Ω resistor to limit the current to 32.4mA, the resistor would have to dissipate:
\$({32.4mA})^2 \times 6791\Omega = 7.1W\$, quite a lot of wasted power and an expensive resistor needed.
So we use the cap to do the main limiting, and resistor in series to limit transient current (if the rise time of the transient is fast, then the cap will look like a lower impedance but the resistor will still look like 500Ω)
Regulation
The rest of the components are to rectify and regulate the voltage, in order to present a steady low voltage DC supply for the IC.
The 2 diodes handle the rectification, only passing the positive half of the waveform. This is then smoothed by the 470uF capacitor, and then regulated by the second 500Ω resistor and (probably 5.2V) zener diode.
So the whole process looks like this (ignore diode part numbers, LTSpice doesn't have any 1N4002 or similar. Also I used a 6.2V zener as there is no 5V zener. The principle is exactly the same though) :
Simulation on power up (notice V(IC) rises to ~6.2V and stays there):
Bypass caps and 10Ω resistor
The 0.1uF capacitors are indeed bypass capacitors, these present a local energy storage for high frequency current demand.
Combined with the caps, The 10Ω resistor is to decouple the analog and digital supplies to some extent.
The analog and digital ground pins are also a way of keeping the currents separate. This is common in ICs with an analog to digital or digital to analog function.
PFMON and 470nF capacitor
The capacitor needs to be rated to handle the mains voltage. There are capacitors called "X capacitors" that are specially certified for use with mains. Here is an example 0.47uF 440VAC part (picking at least 1.5 times the nominal mains is a good idea)
The PFMON pin detects a power fail event when the voltage at the pin falls below 2.45V. This can be used to signal your microcontroller and take any appropriate action. With the (0.66 times input) divider shown we can calculated the input voltage where this will happen:
\$ \dfrac {2.45V} {0.66} = 3.675V \$
The minimum operating voltage is given in the datasheet as 3.135V, so this gives ~0.5V headroom.
No, you don't have a shunt regulator. Q1 is the main pass element. It is working like a linear regulator.
Q2 is the wrong way around. You have C and E flipped. It will still probably have some gain like that, but performance will be better if you flip it the right way around. The concept is that when the output of the R3-R5 voltage divider gets high enough to be the zener voltage plus the B-E drop of Q2, Q2 will turn on, which will steal current from the base of Q1, thereby turning it off more.
I have no idea what you think R2 is doing. It makes no sense.
Best Answer
If you're here asking about the basics of a line-connected power supply for running some hobby project, then you shouldn't be trying to do this at all. This is NOT where you want to learn by experimenting. The cost of mistakes are too high. The results can burn down your house or electrocute you, or someone else.
If you need a little current at 5 V to run a microcontroller from, just buy the power supply, or use a USB power adapter. These things are cheap, small, and easily available. Someone else who actually knows what they are doing has done the engineering to provide the 5 V safely.
The Meanwell IRM-01-5 is just one of many examples. This one mounts on your PCB like any other part, only has a footprint of 1.3 x .9 inches (34 x 22 mm), puts out 200 mA at 5 V, works with line power anywhere in the world, and costs under $5 in singles. Doing this yourself just doesn't make sense.