$$\int_0^{2\pi} \frac{d \theta}{5-3 \cos \theta}$$
My attempt:
Let $z=e^{i\theta}$ which gives $d\theta = \frac{dz}{iz}$
Thus,
$$\oint_C \frac{1}{5-3(\frac{z+z^{-1}}{2})}\frac{dz}{iz}$$
$$=\frac{1}{i}\oint_C \frac{dz}{(3z-1)(z-3)}$$
We can ignore the singularity at $z=3$ because it lies outside the unit circle and thus we don't need to account for it when computing the residues.
$$=\frac{1}{i}\oint_C f(z) \, dz = 2\pi [\operatorname{Res}(f(z),\frac{1}{3})]$$
$$\operatorname{Res}(f(z),\frac{1}{3})=\frac{\lim_{z\to1/3} (3z-1)\cdot \frac{1}{(3z-1)(z-3)}}{0!}$$
$$=-\frac{9}{8}$$
Which yields:
$$=\frac{1}{i}\oint_C f(z) \, dz = 2\pi [-\frac{9}{8}]$$
$$=-\frac{9\pi}{4}$$
But how can I have a negative answer for an integration??? Did I make a mistake somewhere??
It is true that in order to find the roots, you can multiply both sides of $$ 5z-\frac{3z^2} 2 - \frac 3 2 = 0 $$ by $-2$, getting $$ -10z + 3z^2 + 3 = 0, $$ and then using your favorite method of solving quadratic equations, concluding that the roots are $3$ and $1/3$.
But that does not mean that $-10z+3z^2 + 3z$ is equal to $(-1/2)(10z + 3z^2 + 3)$ when the value of $z$ is such that the value of $-10z+3z^2 + 3z$ is not $0$.