One can solve the heat equation $$ \frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} $$ by a separation of variables such that $u(x, t) = f(x)g(t)$.
Substituting this into the equation yields $$ \frac{f''(x)}{f(x)} = \frac{\dot g(t)}{g(t)} = c$$ for some constant $c$.
My question is: why are these ratios constant? I just can't get my head around it.
It is because the left hand side depends only on $x$ while the right hand side depends only on $t$. The two quantities are equal no matter what choice of $x,t$ you choose. We deduce that the quantities are constant, because that is precisely how you define a constant function; a function that returns the same value everywhere, regardless of choice of input.