<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] First: search for:
$$
\dfrac{x}{(x-1)^2}=\dfrac{1}{(x-1)^2}+\dfrac{A}{x-1}
$$
and find: 
$$
x=1+Ax-A \iff x(1-A)=1-A
$$since this must be true $\forall x$ you must have $A-1=0$ and $A=1$.
Now integrates as you have done but be careful that you have a mistake in your work:
$$
\int \dfrac{1}{(x-1)^2} dx = - \dfrac{1}{x-1}
$$
</s>