Evaluating the integral $\int \frac{x^2+x}{(e^x+x+1)^2}dx$ 
Evaluate $$\int \frac{x^2+x}{(e^x+x+1)^2}dx$$ 

I tried converting in the form of Quotient rule(seeing the square in the denominator), neither am I able to make the denominators' derivative in the numerator. Some hints would be great. Thanks.
 A: Let $\displaystyle u=\frac{x^2+x}{xe^x}=(x+1)e^{-x}$ and $\displaystyle dv=\frac{xe^x}{(e^x+x+1)^2}dx,\;$ so $\displaystyle du=-xe^{-x}dx$ and $\displaystyle v=\frac{e^x}{e^x+x+1}$.
Then $\displaystyle\int\frac{x^2+x}{(e^x+x+1)^2}dx=(x+1)e^{-x}\cdot\frac{e^x}{e^x+x+1}-\int-\frac{x}{e^x+x+1}dx=\frac{x+1}{e^x+x+1}+\int\frac{x}{e^x+x+1}dx$
$\displaystyle\hspace{.2 in}=\frac{x+1}{e^x+x+1}+\int\frac{e^x+x+1}{e^x+x+1}dx-\int\frac{e^x+1}{e^x+x+1}dx=\frac{x+1}{e^x+x+1}+x-\ln\big|e^x+x+1\big|+C$
A: One may observe that
$$
\begin{align}
\left(\frac{x+1}{e^x+x+1}\right)'&=\frac{1 \times(e^x+x+1)-(x+1)(e^x+1)}{(e^x+x+1)^2}
\\\\&=\frac{(e^x+x+1)-(x+1)(e^x+x+1)+x(x+1)}{(e^x+x+1)^2}
\\\\&=\frac{-x(e^x+x+1)}{(e^x+x+1)^2}+\frac{x^2+x}{(e^x+x+1)^2}
\\\\&=\frac{\left((e^x+x+1)'-(e^x+x+1)\right)(e^x+x+1)}{(e^x+x+1)^2}+\frac{x^2+x}{(e^x+x+1)^2}
\\\\&=\frac{(e^x+x+1)'}{(e^x+x+1)}-1+\frac{x^2+x}{(e^x+x+1)^2}
\end{align}
$$ giving

$$
\int \frac{x^2+x}{(e^x+x+1)^2}dx=x-\ln\left|e^x+x+1\right|+\frac{x+1}{e^x+x+1}+C
$$

for any constant $C$.
