$ \int\frac{2+\sqrt{x}}{\left(x+\sqrt{x}+1\right)^2}dx$ $$I=\int\frac{2+\sqrt{x}}{\left(x+\sqrt{x}+1\right)^2}dx$$
I can't think of a substitution to solve this problem, by parts won't work here. Can anyone tell how should I solve this problem?

A change of variable $x=t^2$ leads to the integral
$$\int \frac{2t(t+2)}{(t^2+t+1)^2} \;\mathrm dt$$
A general approach is then to use partial fraction decomposition:
$$\frac{2t(t+2)}{(t^2+t+1)^2}=\frac{2}{t^2+t+1}+\frac{2t-2}{(t^2+t+1)^2}\\
=\frac{2}{t^2+t+1}+\frac{2t+1}{(t^2+t+1)^2}-\frac{3}{(t^2+t+1)^2}$$
The first integral can be computed by a change of variable $u=t+\dfrac12$. The second has the form $\dfrac{f'}{f^2}$ so it's easy, and for the last, here is how it's done. First, the same change of variable $u=t+1/2$
$$\int \frac{\mathrm dt}{(t^2+t+1)^2}=\int \frac{\mathrm du}{(u^2+\frac34)^2}$$
Then
$$\int \frac{\mathrm du}{(u^2+\frac34)^2}=\frac43\int \frac{u^2+\frac34-u^2}{(u^2+\frac34)^2}\;\mathrm du=\frac43\int \frac{1}{u^2+\frac34}\;\mathrm du-\frac43\int \frac{u^2}{(u^2+\frac34)^2}\;\mathrm du$$
The first term leads to an arctangent, and for the last:
$$\int \frac{u^2}{(u^2+\frac34)^2}\;\mathrm du=\frac12\int u\frac{2u}{(u^2+\frac34)^2}\;\mathrm du$$
And this can be integrated by parts.
It's rather long and technical, but it's a general method to integrate a rational fraction by partial fraction decomposition, with $(x^2+ax+b)^k$ in the denominator.
