How to find $\int_0^{2\pi} \frac{dt}{1+2\cos(t)}$ The problem is
$$\int_0^{2\pi} \frac{dt}{1+2\cos(t)}.$$ I know it is equal to 
$$\int\limits_{|z|=1}\frac{2dz}{i(1+z)^2}$$
but I don't know how I should calculate the last integral.
 A: Hint:
$$
\int\frac{\mathrm{d}z}{i(1+z)^2}=\frac i{1+z}+C
$$

As suggested in a comment, the Weierstrass Substitution is often useful in integrals such as the original.
$$
\begin{align}
\sin(t)&=\frac{2z}{1+z^2}\\
\cos(t)&=\frac{1-z^2}{1+z^2}\\
\mathrm{d}t&=\frac{2\,\mathrm{d}z}{1+z^2}
\end{align}
$$

Adjusted Hint:
As pointed out by Américo Tavares,
$$
\begin{align}
\int_0^{2\pi}\frac{\mathrm{d}t}{1+2\cos(t)}
&=\int_0^{2\pi}\frac{\mathrm{d}t}{1+e^{it}+e^{-it}}\\
&=\int_0^{2\pi}\frac{e^{it}\,\mathrm{d}t}{e^{2it}+e^{it}+1}\\
&=\oint\frac{-i\,\mathrm{d}z}{z^2+z+1}\\
&=\oint\frac1{\sqrt3}\left(\frac1{z-\omega^2}-\frac1{z-\omega}\right)\,\mathrm{d}z
\end{align}
$$
where $\omega=\frac{-1+i\sqrt3}{2}$.
Since the sum of the residues at $\omega^2$ and $\omega$ is $0$, if we take a branch cut between $\omega$ and $\omega^2$, we can well-define
$$
f(z)=\frac1{\sqrt3}\log\left(\frac{z-\omega^2}{z-\omega}\right)
$$
over the rest of $\mathbb{C}$, and $f'(z)=\dfrac1{\sqrt3}\left(\dfrac1{z-\omega^2}-\dfrac1{z-\omega}\right)$. $f$ works the same as $\dfrac{i}{1+z}$ in my previous hint.
A: If you write
$$
\begin{equation*}
z=e^{it}\qquad \left( 0\leq t\leq 2\pi \right), 
\end{equation*}
$$
since
$$
\begin{equation*}
\cos t=\frac{z+z^{-1}}{2},\qquad dt=\frac{dz}{iz},
\end{equation*}
$$
the integral takes the form
$$
\begin{eqnarray*}
\int\limits_{|z|=1}\left( \frac{1}{1+2\frac{z+z^{-1}}{2}}
\right) \frac{1}{iz}dz &=&\int\limits_{|z|=1}\frac{1}{i}\times 
\frac{1}{z^{2}+z+1}dz \\
&=&\int\limits_{|z|=1}\frac{dz}{i\left( z+\frac{1-i\sqrt{3}}{2}
\right) \left( z+\frac{1+i\sqrt{3}}{2}\right) }
\end{eqnarray*}
$$
and not
$$\int\limits_{|z|=1}\frac{2dz}{i(1+z)^2}.$$

Since $\cos \frac{2\pi }{3}=\cos \frac{4\pi }{3}=-\frac{1}{2}$, hence $1+2\cos \frac{2\pi }{3}=1+\cos \frac{4\pi }{3}=0$, the given integral has singularities at $t\in\{\frac{2\pi, }{3},\frac{4\pi }{3}\}$. We thus split it as follows:
$$
\begin{equation*}
\int_{0}^{\frac{2\pi }{3}}\frac{dt}{1+2\cos t}+\int_{\frac{2\pi }{3}}^{\frac{4\pi }{3}}\frac{dt}{1+2\cos t}+\int_{\frac{4\pi }{3}}^{2\pi }\frac{dt}{1+2\cos t}.
\end{equation*}
$$
Each integral is a divergent improper integral of the second kind. Using the Weirstrass substitution$^1$  $x=\tan \frac{t}{2}$, for instance the first integral becomes
$$
\begin{eqnarray*}
I_{1} &=&\int_{0}^{\frac{2\pi }{3}}\frac{1}{1+2\cos t}dt,\qquad x=\tan \frac{t}{2} \\
&=&\int_{0}^{\sqrt{3}}\frac{2}{\left( 1+2\frac{1-x^{2}}{1+x^{2}}\right)
\left( 1+x^{2}\right) }\,dx \\
&=&\int_{0}^{\sqrt{3}}\frac{2}{3-x^{2}}\,dx,\qquad x=\sqrt{3}u \\
&=&\frac{2\sqrt{3}}{3}\int_{0}^{1}\frac{1}{1-u^{2}}\,du \\
&=&\left. \frac{2\sqrt{3}}{3}\operatorname{arctanh}u\right\vert _{0}^{1}=\infty .
\end{eqnarray*} 
$$
--
$^1$ The Weierstrass substitution is a universal standard substitution to evaluate an integral of a rational fraction in $\sin t,\cos t$, i.e. a rational fraction of the form 
$$R(\sin t,\cos t)=\frac{P(\sin t,\cos t)}{Q(\sin t,\cos t)},$$
where $P,Q$  are polynomials in $\sin t,\cos t$ 
$$
\begin{equation*}
\tan \frac{t }{2}=x,\qquad t =2\arctan x,\qquad dt =\frac{2}{1+x^{2}}dx
\end{equation*},
$$
which converts the integrand into a rational function in $x$. We know from trigonometry (see this answer) that 
$$\cos t =\frac{1-\tan ^{2}\frac{t }{2}}{1+\tan ^{2}\frac{
t}{2}}=\frac{1-x^2}{1+x^2},\qquad \sin t =\frac{2\tan \frac{t }{2}}{1+\tan ^{2}
\frac{t }{2}}=\frac{2x}{1+x^2}.$$
A: Open,$\cos(t)$ as $1-2\sin^2(t/2)$,
The denominator of your integral then becomes,$3-4\sin^2(t/2)$.
Multiply $\sec^2(t/2)$ in the Numerator and Denominator.
Your integrand  then becomes,$\frac{\sec^2(t/2)}{3\sec^2(t/2)-4\tan^2(t/2)}$
Substitute,$z=\tan(t/2)$
Your integrand now modifies to(ignoring constants),$\frac{1}{3-z^2}$,
which is of known form and can be resolved using numerous methods(one of them being partial fractions)
A: First, note that, the original integral is an improper integral since the integrand has singularities in the interval of integration $[0,2\pi]$. Namely, $t=\frac{2}{3}\pi$ and $\frac{4}{3}\pi$. You can find these singularities by solving the equation
$$ 1 + 2\cos(t) = 0. $$
So, you should know how to handle this integral. Here is the value of the indefinite integral
$$ \frac{2}{\sqrt {3}}\,\,{\it \tanh^{-1}} \left( \frac{1}{\sqrt{3}}\,\tan \left( \frac{t}{2} \right) \right) .$$
For the complex integral, you can see that you have a pole on the path of integration as I pointed out in my comment. 
