Find the solution to
$$u_t=u_{xx}-xu_x, \quad u(x,0)=x^{2}$$
To apply separation of variables, let $u(x,t)= X(x)T(t)$, then $$u_t=u_{xx} - x u_{x} \implies XT' = X'' T - x X' T \implies \frac{T'}{T} = \frac{X'' - x X'}{X}$$
Let
\begin{align} \frac{T'}{T} &= \frac{X''-xX'}{X} \\ &= k \\ \end{align}
which gives the two ODEs
\begin{align} T' - kT &= 0 \\ X'' - x X' - k X &= 0 \end{align}
How do we proceed from here?
$$u_t=u_{xx}-xu_x \tag 1$$ Before starting the method of separation of variables, note that $u(x,y)=C$=constant is solution of the PDE. If fact, you are looking for particular solutions on the form $u(x,y)=X(x)T(t)+C$. Then we go directly to the continuation of your calculus.
The solutions of $X''-xX'-kX=0$ involve Hermite polynomials. But, even without knowing this, one can guess that $X(x)$ might be a simple second degree polynomial : $X(x)=ax^2+bx+c$ . Putting it into $X''-xX'-kX=0$ the identification leads to : $$k=-2\quad;\quad b=0 \quad;\quad c=-a \quad\text{then}\quad X(x)=a(x^2-1)$$ $$u(x,t)=a(x^2-1)e^{-2t}+C$$
We determine $a$ and $C$ according to the condition $u(x,0)=x^2$
$a(x^2-1)+C=x^2$ leads to $a=1$ and $C=1$. The solution is : $$u(x,t)=(x^2-1)e^{-2t}+1$$