<s>[INST] 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.
 [/INST] 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$.
</s>