$ \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: Just as  juantheron commented, the idea is first to get rid of the radical and putting $$x=t^2 \implies dx=2t \,dt$$ you then have $$I=\int\frac{2+\sqrt{x}}{\left(x+\sqrt{x}+1\right)^2}dx=\int\frac{2 t (t+2)}{\left(t^2+t+1\right)^2}dt$$ Because of the square in denominator, let us admit that the solution is $$I=\frac{P_n(t)}{t^2+t+1}$$ where $P_n(t)$ is a polynomial of degree $n$. So, differentiating both sides with respect to $t$, we have $$\frac{2 t (t+2)}{\left(t^2+t+1\right)^2}=\frac{\left(t^2+t+1\right) P_n'(t)-(2 t+1) P_n(t)}{\left(t^2+t+1\right)^2}$$ that is to say $${2 t (t+2)}={\left(t^2+t+1\right) P_n'(t)-(2 t+1) P_n(t)}\tag 1$$ Now, compare the degrees : lhs is of degree $2$ while rhs is of degree $n+1$ which makes $n=1$.
So, let $P_1(x)=a+b t$; replace in $(1)$ and identify the coefficients.
I am sure that you can take it from here.
Edit
The question is : does this work all time ?
Consider $$I=\int\frac{ \left(A+B \sqrt{x}\right)}{\left(x+\sqrt{x}+1\right)^2}dx=\int\frac{2 t (A+B t)}{\left(t^2+t+1\right)^2}dt$$ and let us do the same. We should end with $$2 t (A+B t)=-2 a t-a-b \left(t^2-1\right)$$ that is to say $$2At+2Bt^2=(b-a)-2 a t-b t^2$$ Grouping terms of ame powers, this leads to $$(a-b)+2  (a+A)t+ (b+2 B)t^2=0$$ This would imply $a=b$, $a=-A$, $b=-2B=a$ and then $\color{red}{A=2B}$. If this is not the case, the procedure will not work and the antiderivative would become much more complex becoming
$$I=-\frac{2 (t (A+B)+(2 A-B))}{3 \left(t^2+t+1\right)}-\frac{4 (A-2 B) }{3 \sqrt{3}}\tan ^{-1}\left(\frac{2 t+1}{\sqrt{3}}\right)$$
A: Another way you might be interested .
Notice that $$\frac{d}{dx}\left(\frac{1}{x+\sqrt x+1}\right)=\frac{-(1+\frac{1}{2\sqrt x})}{(x+\sqrt x+1)^2}$$
Put then $$\int\frac{2+\sqrt{x}}{\left(x+\sqrt{x}+1\right)^2}dx=\frac{A+B\sqrt x+Cx}{x+\sqrt x+1}$$ and take the derivative in both sides. You get at once $C=0$ and the system $$2\sqrt x(2+\sqrt x)=-A(2\sqrt x+1)+B(1-x)$$ which gives $A=B=-2$.
Thus $$\int\frac{2+\sqrt{x}}{\left(x+\sqrt{x}+1\right)^2}dx=\frac{-2(\sqrt x+1)}{x+\sqrt x+1}$$
A: Let $$I = \int\frac{2+\sqrt{x}}{(x+\sqrt{x}+1)^2}dx = \int \frac{2+\sqrt{x}}{x^2\left(1+x^{-\frac{1}{2}}+x^{-1}\right)^2}dx$$
So $$I = \int\frac{2x^{-2}+x^{-\frac{3}{2}}}{\left(1+x^{-\frac{1}{2}}+x^{-1}\right)^2}dx$$
Put $\left(1+x^{-\frac{1}{2}}+x^{-1}\right) = t\;,$ Then $\displaystyle \left(-\frac{1}{2}x^{-\frac{3}{2}}-x^{-2}\right)dx = dt\Rightarrow \left(2x^{-2}+x^{-\frac{3}{2}}\right)dx = -2dt$
So $$I = -2\int\frac{1}{t^2}dt = \frac{2}{t}+\mathcal{C} = \frac{2}{1+x^{-\frac{1}{2}}+x^{-1}}+\mathcal{C}=\frac{2x}{x+\sqrt{x}+1}+\mathcal{C}$$
So $$I = 2\left[\frac{(x+\sqrt{x}+1)-(\sqrt{x}+1)}{x+\sqrt{x}+1}\right]+\mathcal{C} = -\frac{2(\sqrt{x}+1)}{x+\sqrt{x}+1}+\mathcal{C'}$$
A: 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.
