$\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?

Here's a way to find the partial fraction expansion:
\begin{align}
\frac{x}{(x-1)^2} &= \frac{A}{x-1} + \frac{B}{(x-1)^2}\\
(x-1)^2\frac{x}{(x-1)^2} &= (x-1)^2\frac{A}{x-1} + (x-1)^2\frac{B}{(x-1)^2}\\
x &= A(x-1) + B
\end{align}
You can turn this into two linear equations and solve, or you can do the following:


*

*plug in $x = 1$ to get $1 = B$. 

*Take derivatives on both sides to get 


$$
1 = A
$$


*Plug $x = 1$ into this equation (which does nothing, but it's part of a pattern) to get $1 = A$.


In general, you plug in $x = c$ for this kind of equation [polynomial over a power of $x-c$], and for each derivative, and doing so will give you the coefficients one after another. 
Is there an intuition for these partial fraction expansions? Yes, a slight one ...but it'll mostly come after you take Complex Analysis, alas. 

Also: in integrating $1/(x-1)^2$, you have a sign error. 
