Indefinite integral $\int xe^x (x+1)^{-2}dx$ I was solving a differential equation by reduction of order, and was required to evaluate the indefinite integral
$$I=\int \frac{xe^x}{(x+1)^2}dx.$$
The only method that came to mind was inspection, i.e. recognizing that 
$$ \frac{d}{dx} \frac{e^x}{x+1} = \frac{xe^x}{(x+1)^2}.$$
I would not trust myself to recognize this under the pressure of a test or exam, so is it possible to evaluate $I$ by substitution, parts, or some other method?
 A: A nice trick is to write $\frac{x}{(1+x)^2}$ as $\frac{(x+1)-1}{(x+1)^2}=\frac{1}{(x+1)}-\frac{1}{(x+1)^2}$, then apply integration by parts:
$$ \int \frac{e^x}{(1+x)^2}\,dx = -\frac{e^x}{1+x}+\int \frac{e^x}{(1+x)}\,dx.$$
A: Notice  $$\int \frac{xe^x}{(x+1)^2}\ dx $$ $$=\int \frac{(x+1-1)e^x}{(x+1)^2}\ dx $$
$$=\int e^x\left( \frac{(x+1)}{(x+1)^2}-\frac{1}{(x+1)^2}\right)\ dx $$
$$=\int e^x\left( \frac{1}{(x+1)}-\frac{1}{(x+1)^2}\right)\ dx $$
let $x+1=t\implies dx=dt$
$$=\int e^{t-1}\left( \frac{1}{t}-\frac{1}{t^2}\right)\ dx $$
$$=\frac{1}{e} \int e^{t}\left( \frac{1}{t}-\frac{1}{t^2}\right)\ dx $$
Using $\int e^x(f(x)+f'(x))dx=e^xf(x)+C$ 
$$=\frac{e^{t}}{e}\frac{1}{t}+C $$
$$=\frac{e^{t-1}}{t}+C $$
$$=e^{x}\frac{1}{x+1}+C $$
A: $\int\dfrac{xe^x}{(x+1)^2}dx$
$=-\int xe^x~d\left(\dfrac{1}{x+1}\right)$
$=-\dfrac{xe^x}{x+1}+\int\dfrac{1}{x+1}d(xe^x)$
$=-\dfrac{xe^x}{x+1}+\int\dfrac{(x+1)e^x}{x+1}dx$
$=-\dfrac{xe^x}{x+1}+\int e^x~dx$
$=-\dfrac{xe^x}{x+1}+e^x+C$
$=\dfrac{(x+1)e^x-xe^x}{x+1}+C$
$=\dfrac{e^x}{x+1}+C$
