Assume that we have some fluid in a container. It has been allowed to sit quietly so that everything has settled into equilibrium. No movement. Assume that the fluid has a uniform density. The top is exposed to the air. We will take this to be at zero pressure. There is a point at the bottom of the container and we wish to determine the pressure at that point.
Let ##\rho## be the density of the fluid and ##g## be the acceleration of gravity (which we assume is uniform over the region in question).
Imagine a small cube-shaped volume at a fixed position somewhere in the midst of this fluid. This is just an imaginary cube. The boundaries are simply drawn in, they are not physical. There is pressure on all six faces of this cube. Top, bottom, left, right, front, back. Since everything is in equilibrium, we can conclude that the pressure on each of the faces is approximately equal. If the pressures were not equal, fluid would be flowing through this cube -- in through the face with the higher pressure and out through the face with lower pressure. The [average] pressure on the front, back, left and right faces must be exactly equal. The pressure on the top and bottom faces however must be different by just enough to support the fluid in the volume. (Otherwise fluid would flow in the top and out the bottom. Or vice versa)
Let ##d h## be the height of such a cube. Its volume is ##(d h)^3##. Its mass is ##\rho (d h)^3##. The force of gravity on the cube is ##\rho g (d h)^3##. The area of the top and bottom faces is each ##(d h)^2##. The pressure difference (##dp##) between top and bottom must then satisfy:
$$dp\ (d h)^2 = \rho g (d h)^3$$.
Simplifying, that becomes:
$$dp = \rho g\ dh$$
Now, back to our fluid. Starting at any point on the top of the fluid, draw a continuous line from there to the point where we want to determine the pressure. Keep this line a little bit away from the container walls. Now pick a cube size that is small enough that you can build a continuous chain of cubes following the path you just drew so that the path is entirely contained within these cubes. Line up the cubes so that they are dead centered face to face.
Follow this chain of cubes from beginning to end.
As you move from one cube to the next horizontally, the pressure stays the same.
As you move from one cube to the next downward, the pressure increases by ##\rho g\ dh##
As you move from one cube to the next upward (for instance if the path wiggles up and down), the pressure decreases by ##\rho g\ dh##.
By the time you get to the target point at depth ##h##, it should be clear that you will have seen the pressure increase by a total of ##\rho g\ h##.