Considering $$I=\int\frac{1+2\cos (x)}{(2+\cos (x))^2}\,dx$$ you can do several things.
First, considering the squared denominator, you could suppose that the result of integration would be something like $$\frac {a+b\sin(x)+c\cos(x)}{2+\cos(x)}$$ which, one differentiated, would give $$\frac{(a-2 c) \sin (x)+2 b \cos (x)+b}{(2+\cos (x))^2}$$ So, $$\frac{(a-2 c) \sin (x)+2 b \cos (x)+b}{(2+\cos (x))^2}=\frac{1+2\cos (x)}{(2+\cos (x))^2}$$ Removing the denominator let us with $$(a-2 c) \sin (x)+2 (b-1) \cos (x)+b-1=0$$ So, $b=1$, $a-2c=0$ makes $$I=\frac{\sin(x)}{2+\cos (x)}$$
The second way would use the tangent half-angle substitution $t=\tan(\frac x2)$ which would lead to $$I=\int\frac{1+2\cos (x)}{(2+\cos (x))^2}\,dx=-\int\frac{2 \left(t^2-3\right)}{\left(t^2+3\right)^2}\,dt$$ which is not very difficult to integrate.
I am sure that you can takle from here.