Trying to do integration using residue theorem prove using residue theorem $$\int_{0}^{2\pi}\frac{\cos2\theta}{5+4\cos\theta}d\theta={\pi}/6$$
I tried by using $$z=e^{i\theta}$$
now $$\cos\theta=\frac{e^{i\theta}+e^{-i\theta}}{2}=\frac{z+z^{-1}}{2}$$
$$dz=izd\theta$$
$$\int_{0}^{2\pi}\frac{\cos2\theta}{5+4\cos\theta}d\theta=\int_{0}^{2\pi}\frac{2\cos^2\theta-1}{5+4\cos\theta}d\theta=\int_{|z|=1}\frac{(z^4+1)dz}{2iz^2(2z+1)(z+2)}$$
Now poles occur at $$z=0, -1/2, -2$$
rejecting $$z=-2,$$as $$ |z|=2>1$$
Now $$Res_{z=-1/2}=\frac{(-1/2)^4+1)}{2i(-1/2)^2(-1/2+2)}=17/12i$$
Pole at z=0 is  of order 2
$$Res_{z=0}=\lim_{z \to 0} \frac{d}{dz}(\frac{(z^4+1)}{2i(2z+1)(z+2)})=-5/8i$$
$$\int_{0}^{2\pi}\frac{\cos2\theta}{5+4\cos\theta}d\theta={2\pi}i(Res_{z=-1/2}+Res_{z=0})=19{\pi}/12$$
But the answer is $${\pi}/6$$
I tried many times, but i get the same answer

$\displaystyle \int_{|z|=1}\frac{(z^4+1)dz}{2iz^2(2z+1)(z+2)}$, should be converted to $\displaystyle \frac{1}{i}\int_{|z|=1} \frac{1+z^4}{4z^2(z+2)(z+1/2)}$. From there, you can see you have poles at $z=-2$, $z=0$ (order $2$), and $z=-\dfrac{1}{2}$. Since we only care about the poles inside the unit circle, we can evaluate the two resides as follows:
$$2\pi i \operatorname{Res}\left(\frac{1+z^4}{4z^2(z+2)(z+1/2)}, z=0\right) = \frac{2\pi i}{(2-1)!}\lim_{z \to 0}\frac{d^{2-1}}{dz^{2-1}}\frac{(z-0)^2\left(1+z^4\right)}{4z^2(z+2)(z+1/2)} = -\frac{10\pi i}{8}$$
and
$$2\pi i\operatorname{Res}\left(\frac{1+z^4}{4z^2(z+2)(z+1/2)}, z=-\dfrac{1}{2}\right) = 2\pi i \lim_{z\to -1/2}\frac{\left(z+\frac{1}{2}\right)\left(1+z^{4}\right)}{4z^{2}\left(z+2\right)\left(z+1/2\right)} = \frac{34\pi i}{24}.$$
Therefore, the integral is
$$\frac{1}{i}\left(\frac{34\pi i}{24}-\frac{10\pi i}{8}\right)=\frac{\pi}{6}.$$
