<s>[INST] Difficult definite integration $\int_{-2}^{0}\frac{x^2 + x - 5}{(x-1)^2}e^x\,\mathrm dx$ I found an integral in a contest that seems very difficult to compute. The answer is $-2$, however, I do not know how to arrive at this answer.
$$\int_{-2}^{0}\frac{x^2 + x - 5}{(x-1)^2}e^x\,\mathrm dx$$
At first I tried to make the substitution $u = x - 1$, but I did not get anywhere. I also tried to expand the denominator and perform synthetic division, which did not help so much either.
Also, I don't think it is possible to do partial fraction decomposition since the degree of the denominator is equal to the degree of the numerator.

Attempt with substitution (Moo's help) -
Let $u = x - 1$. Then, $du = 1$
$$\begin{align}
I &= \int_{-2}^{0} \frac{x^2 + x - 5}{(x - 1)^2} e^x\,\mathrm dx =\\
&= \int_{-2}^{0} \frac{x^2 + x - 5}{u^2} e^{u+1}\,\mathrm du =\\
&= \int_{-2}^{0} \frac{e^{u+1}(x^2 + x - 5)}{u^2}\,\mathrm du
\end{align}$$
Now, $x = u + 1$, $x^2 = u^2 + 2u + 2$ and therefore
$$I = \int_{-3}^{-1} \frac{e^{u+1}(u^2 + 3u - 2)}{u^2}\mathrm du = e \int_{-3}^{-1} e^{u}\frac{u^2 + 3u - 3}{u^2}\mathrm du$$
 [/INST] Integration by part we get
\begin{align*}
\int\frac{x^2 + x - 5}{(x-1)^2}e^x \, \mathrm{d}x&=-\frac{x^2 + x - 5}{x-1}e^x +\int e^{x}\left ( x+4 \right )\, \mathrm{d}x  \\
&=-\frac{x^2 + x - 5}{x-1}e^x+e^{x}\left ( x+3 \right )\\
&=\frac{x+2}{x-1}e^{x}
\end{align*}
Then you can take it from here.
</s>