How do I integrate this?
$$\int_0^{2\pi}\frac{dx}{2+\cos{x}}, x\in\mathbb{R}$$
I know the substitution method from real analysis, $t=\tan{\frac{x}{2}}$, but since this problem is in a set of problems about complex integration, I thought there must be another (easier?) way.
I tried computing the poles in the complex plane and got $$\text{Re}(z_0)=\pi+2\pi k, k\in\mathbb{Z}; \text{Im}(z_0)=-\log (2\pm\sqrt{3})$$ but what contour of integration should I choose?
For completeness, we know that $\cos(x) = \frac{e^{ix}+e^{-ix}}{2}$ and from @danielfischer's comment, $z=e^{ix}$, we are able to obtain $\cos(z) = \frac{z + 1/z}{2}$. Then $dx =\frac{dz}{iz}$. Therefore, we have the following integral were $\gamma$ is to be taking counter clockwise such that $|z|=1$ $$ \int_{\gamma}\frac{1}{2 + \frac{z + 1/z}{2}}\frac{dz}{iz} = \int_{\gamma}\frac{2z}{4z + z^2 + 1}\frac{dz}{iz} $$ Then the poles occur at $z^2 + 4z + 1$. However, we only need to consider the pole in the contour.