<s>[INST] $\int \frac{x^3+2}{(x-1)^2}dx$ In order to integrate 
$$\int \frac{x^3+2}{(x-1)^2}dx$$ 
I did:
$$\frac{x^3+2}{(x-1)^2} = x+2+3\frac{x}{(x-1)^2}\implies$$
$$\int \frac{x^3+2}{(x-1)^2} dx= \int x+2+3\frac{x}{(x-1)^2}dx$$
But I'm having trouble integrating the last part:
$$\int \frac{x}{(x-1)^2}dx$$
Wolfram alpra said me that:
$$\frac{x}{(x-1)^2} = \frac{1}{(x-1)} + \frac{1}{(x-1)^2}$$
How to intuitively think about this partial fraction expansion? I've seen some examples but suddenly these conter intuitive examples opo out and I get confused. I can check that his is true but I couldn't find this expansion by myself
Then:
$$\int \frac{x}{(x-1)^2} dx = \int \frac{1}{(x-1)} + \frac{1}{(x-1)^2}dx = \ln (x-1) + (x-1)^{-1}$$
Then:
$$\int \frac{x^3+2}{(x-1)^2} dx= \int x+2+\frac{x}{(x-1)^2}dx = \frac{x^2}{2} + 2x + 3[\ln(x-1)+(x-1)^{-1}]$$ but wolfram alpha gives another answer. What I did wrong?
 [/INST] change of variable gets you there faster. let $u = x - 1, x = 1 + u.$  then
$\begin{align}\int\dfrac{x^3 + 2}{(x-1)^2}\,dx  &= \int\frac{(1+u)^3+2}{u^2} \,du\\
&=\int\frac{3+3u+3u^2+u^3}{u^2}\,du\\
& = \int3u^{-2}+3u^{-1}+ 3+u \,du\\
&=-\frac{3}{u} + 3\ln u + 3u + \frac{u^2}{2} +C
\end{align}$
note that this substitution works on any rational function of the form $\dfrac{p(x)}{(ax+b)^k}$ where $p$ is polynomial in $x.$
</s>