Evaluate the integral $\int \frac{x^2(x-2)}{(x-1)^2}dx$ 
Find $$\int \frac{x^2(x-2)}{(x-1)^2} dx .$$

My attempt:
$$\int \frac{x^2(x-2)}{(x-1)^2}dx = \int \frac{x^3-2x^2}{x^2-2x+1}dx $$
By applying polynomial division, it follows that
$$\frac{x^3-2x^2}{x^2-2x+1} = x + \frac{-x}{x^2-2x+1}$$
Hence $$\int \frac{x^3-2x^2}{x^2-2x+1}dx  = \int \left(x + \frac{-x}{x^2-2x+1}\right) dx =\int x \,dx + \int \frac{-x}{x^2-2x+1} dx \\ = \frac{x^2}{2} + C + \int \frac{-x}{x^2-2x+1} dx $$  Now using substitution $u:= x^2-2x+1$ and $du = (2x-2)\,dx $ we get $dx= \frac{du}{2x+2}$.
Substituting dx in the integral:
$$\frac{x^2}{2} + C + \int \frac{-x}{u} \frac{1}{2x-2} du =\frac{x^2}{2} + C + \int \frac{-x}{u(2x-2)}  du $$
I am stuck here. I do not see how using substitution has, or could have helped solve the problem. I am aware that there are other techniques for solving an integral, but I have been only taught substitution and would like to solve the problem accordingly.
Thanks

The most efficient method is probably to substitute $t := x - 1$, as I see Yves has done in his answer, as this rewrites the integrand as a sum of power functions. In you don't see this, proceeding the standard way goes as follows:
After writing the integrand as a 'proper polynomial fraction', rewrite the denominator in factored form:
$$\frac{x^3-2x^2}{x^2-2x+1} = x - \frac{x}{x^2-2x+1} = x - \frac{x}{(x - 1)^2}.$$
We know from the method of partial fractions that we can put the second term in the form
$$\frac{x}{(x - 1)^2} = \frac{A}{x - 1} + \frac{B}{(x - 1)^2} .$$
We can cross-multiply and compare like coefficients to solve for $A$ and $B$, but we can do this more quickly in this case by writing
$$\frac{x}{(x - 1)^2} = \frac{(x - 1) + 1}{(x - 1)^2} = \frac{1}{x - 1} + \frac{1}{(x - 1)^2} .$$
The integrals of the two terms on the right-hand side are elementary.
