I have the integral:
$$\int_0^{2\pi}\frac{d\varphi}{(2+\cos \varphi)^2}$$
putting standard substitutions:
$$\cos\varphi =\frac{1}{2}\left(z+\frac{1}{z}\right) \\ d\varphi = \frac{idz}{z}$$
and simplifying, I got:
$$2i\oint\limits_{|z| = 1}\frac{dz}{z^2+2z+1}$$
and solving the denumerator I finally got:
$$2i\oint\limits_{|z| = 1} \frac{dz}{(z+1)^2}$$
which means there is second - order pole at $z = -1$
but applying the formula for residue calculating I got:
$$\lim_{z \to -1}\frac{d}{dz} \frac{(z+1)^2}{(z+1)^2}$$
but it means thet the fraction tends to $1$ and therefore the derivarive tends to 0 as the whole limit and therefore the residue :/ Where am I wrong?
Note that
$$\begin{align} \frac{1}{(2+\cos(\phi))^2}\,d\phi&=\frac{1}{\left(2+\frac{z+z^{-1}}{2}\right)^2}\,\frac{1}{iz}\,dz\\\\ &=\frac{-i4z}{\left(z^2+4z+1\right)^2}\,dz\\\\ &=\frac{-i4z}{(z+2+\sqrt3)^2(z+2-\sqrt3)^2}\,dz\\\\ \end{align}$$
There is a second order pole at $z=-2+\sqrt 3$ inside the unit circle. Can you evaluate the reside?