If you have two points at the same height and they're connected by fluid and the fluid is not moving, the pressure at these two points is going to be the same. That's how you get Py=Pz.
Note that we did not even mention what was above these two points. That's because it does not matter. Above y you have a really high column of air, which gives you the atmospheric pressure. Above z you have a column of Hg with some vacuum above it. All the pressure from the Hg comes from it's weight. Since Py=Pz and Py is atmospheric pressure and Pz is the pressure of the column of Hg, you can determine that Patm=Phg= [Hg density]*g*h
If you want to derive Phg:
Volume of the Hg column is h*r^2*pi, mass is h*r^2*pi*density, weight is h*r^2*pi*density*g,
the area over this weight is distributed is r^2*pi, which means that the pressure is h*r^2*pi*density*g/(r^2*pi)=h*density*g
As for your more general question - pressure will be the same at points at the same elevation when there is no fluid movement. There are all sorts of examples with fluids and U shaped tubes that this is applicable. We had some interesting ones in my physics course but I don't know if I kept them around. I'll post them, if I find them.