<s>[INST] Find $\int \frac{dx}{(2+\sin x)^2}$: stuck at $\frac{1}{2}\int \frac{du}{u^2+u+1} - \frac{1}{2}\int \frac{udu}{(u^2+u+1)^2}$ 
Find $\int \frac{dx}{(2+\sin x)^2}$.

$\tan \frac{x}{2}:=u$, $\sin x = \frac{2u}{1+u^2}$, $dx=\frac{2du}{1+u^2}$.
$$\int \frac{\frac{2du}{1+u^2}}{(2+\frac{2u}{1+u^2})^2}$$
$$\frac{1}{2}\int \frac{\frac{du}{1+u^2}}{(1+\frac{u}{1+u^2})^2}$$
$$\frac{1}{2}\int {\frac{du}{(1+u^2)(1+\frac{u}{1+u^2})^2}}$$
$$\frac{1}{2}\int {\frac{(1+u^2)du}{(1+u^2)^2(1+\frac{u}{1+u^2})^2}}$$
$$\frac{1}{2}\int {\frac{(1+u^2)du}{(1+u^2+u)^2}}$$
$$\frac{1}{2}\int {\frac{(u^2+u+1-u)du}{(u^2+u+1)^2}}$$
$$\frac{1}{2}\int \frac{du}{u^2+u+1} - \frac{1}{2}\int \frac{udu}{(u^2+u+1)^2}$$
I am completely lost about what's next. 
Thank you.
 [/INST] There are a few ways that you could do it, but I would probably do it like this:
$$I_1=\int\frac{du}{u^2+u+1}$$
$$=\int\frac{du}{(u+\frac12)^2+\frac34}$$
$$I_2=\int\frac{udu}{(u^2+u+1)^2}$$
$$=\frac12\int\frac{(2u+1)du}{(u^2+u+1)^2}-\frac12\int\frac{du}{(u^2+u+1)^2}$$
Both of these are now in a form which can easily be solved. $I_1$ can be put in the form $\frac{1}{y^2+1}$ which is integrated to give $\arctan(y)$. The first part of $I_2$ has the top as the derivative of the inside of the brackets on the bottom, so a subsitution easily simplifies this. The second part of $I_2$ using a similar method to $I_1$ and then a reduction formula
</s>