How do I derive the formula for lithostatic (overburden) pressure?
This isn't that difficult, but anything is if you start from the wrong place. Let's derive this thing:

$$P = \frac{F}{A}$$

Where $P$ is pressure, and $A$ is the area the force is pushing down on. Let's take a break and derive the units first, just so we know our end derivation is correct; $F$ is in Newtons, which comes out to $\mathrm{kg} \times \frac{\mathrm{m}}{\mathrm{s}^2}$ and $A$ is in $\mathrm{m}^2$. This means that pressure is $\frac{\mathrm{kg}}{\mathrm{m}\times\mathrm{s}^2}$. So your first substitution is correct. 

Now that that is established, let's think about lithostatic pressure, and break up the original equation:

$$P = \frac{M \times a}{A} $$

We know that $a = g$, gravitational acceleration, but what we really want is to figure out how to get this equation in terms of density, so 

$$\rho = \frac{M}{V}$$

where $\rho$ is density, $M$ is mass, and $V$ is volume. If we substitute this equation in for mass in the pressure equation, we get 

$$P = \frac{\rho V \times g}{A}$$

let's now separate $V$ and $A$, $$V = \ell \times w \times h$$ $$A = \ell \times w$$

So canceling out $\ell$ and $w$, our final equation shows

$$P = \rho gh$$

or lithostatic pressure.