The Schrödinger equation for the hydrogen atom in polar coordinates is:
$$ -\frac{\hbar^2}{2\mu}\left[\frac{1}{r^2}\frac{\partial}{\partial r}\left(r^2\frac{\partial \psi}{\partial r}\right) + \frac{1}{r^2\sin{\theta}}\frac{\partial}{\partial \theta}\left(\sin{\theta}\frac{\partial\psi}{\partial\theta}\right)+\frac{1}{r^2\sin^2{\theta}}\frac{\partial^2\psi}{\partial \phi^2}\right]-\frac{Ze^2}{4\pi\epsilon_0 r}\psi=E\psi $$
Which can be written as::
$$\frac{1}{r^2}\frac{\partial}{\partial r}\left(r^2\frac{\partial\psi}{\partial r}\right)+\frac{1}{r^2\sin\theta}\frac{\partial}{\partial\theta}\left(\sin\theta\frac{\partial\psi}{\partial\theta}\right)+\frac{1}{r^2\sin^2\theta}\frac{\partial^2\psi}{\partial\phi^2}+\frac{2\mu}{\hbar^2}\left(E+\frac{Ze^2}{4\pi\epsilon_0r}\right)\psi=0 $$
Using the separation of variables, we assume a product solution of a radial and an angular function:
$$\psi(r,\theta,\phi)=R(r)\cdot Y(\theta,\phi).$$
Since $Y$ does not depend on $r$, we can put it in front of the radial derivative:
$$\frac{\partial\psi}{\partial r}=\frac{\partial}{\partial r}RY=Y\frac{{\rm d}R}{{\rm d}r},$$
and, similarly, $R$ does not depend on the angular variables. Thus replace $\psi$ and the differentials:
$$\frac{Y}{r^2}\frac{\rm d}{{\rm d}r}\left(r^2\frac{{\rm d}R}{{\rm d}r}\right)+\frac{R}{r^2\sin\theta}\frac{\partial}{\partial\theta}\left(\sin\theta\frac{\partial Y}{\partial\theta}\right)+\frac{R}{r^2\sin^2\theta}\frac{\partial^2Y}{\partial\phi^2}+\frac{2\mu}{\hbar^2}\left(E+\frac{Ze^2}{4\pi\epsilon_0r}\right)RY=0. $$
Multiply by $r^2$ and divide by $RY$ to separate the radial and angular terms:
$$\bbox[pink]{\frac{1}{R}\frac{\rm d}{{\rm d}r}\left(r^2\frac{{\rm d}R}{{\rm d}r}\right)}+\bbox[lightblue]{\frac{1}{Y\sin\theta}\frac{\partial}{\partial\theta}\left(\sin\theta\frac{\partial Y}{\partial\theta}\right)+\frac{1}{Y\sin^2\theta}\frac{\partial^2Y}{\partial\phi^2}}+\bbox[pink]{\frac{2\mu r^2}{\hbar^2}\left(E+\frac{Ze^2}{4\pi\epsilon_0r}\right)}=0$$
The first and fourth terms depend on $r$ only, the middle terms depend on the angles only. They can only balance each other for all points in space if the radial and angular terms are the same constants but with opposite signs.
Therefore, we can separate into a radial equation:
$$\bbox[pink]{\frac{\rm d}{{\rm d}r}\left(r^2\frac{{\rm d}R}{{\rm d}r}\right)+\frac{2\mu r^2}{\hbar^2}\left(E+\frac{Ze^2}{4\pi\epsilon_0r}\right)R}-AR=0$$
and an angular equation:
$$\bbox[lightblue]{\frac{1}{\sin\theta}\frac{\partial}{\partial\theta}\left(\sin\theta\frac{\partial Y}{\partial\theta}\right)+\frac{1}{\sin^2\theta}\frac{\partial^2Y}{\partial\phi^2}}+AY=0,$$
where $A$ is the separation constant.
That's how it's done. Now maybe it's because it's almost two in the night that I don't get it, but why should $A$ be the same everywhere (or any time)? Can't $A$ depend on the three polar variables (and one time coordinate), so it's not a constant but a function of the three (four) variables, $A(\rho,\psi,\theta,(t))$? In that case, the last two equations will still hold and the two terms will still balance each other out in all points of space (and time). I must have overlooked something, but what?? Maybe this is more a math question, but the context is the hydrogen atom.