<s>[INST] Rusty at complex integrals, finding error in steps I am looking for some help spotting where I messed up some computations, it's been awhile... I'll show my work to my answer and then say what the correct answer is...
Integrate:
$$\int_0^{2\pi} \frac{\cos(3\theta)}{5-4\cos(\theta)}\mathrm{d}\theta$$
Let $z=e^{i\theta}$ for $0\leq \theta \leq 2\pi$. Then $|z|=1$ and 
$$\cos(3\theta)=\frac{z^3+z^{-3}}{2}=\frac{z^6+1}{2z^3}$$ and 
$$\cos(\theta)=\frac{z+z^{-1}}{2}$$ implies 
$$\frac{\cos(3\theta)}{5-4\cos(\theta)}=\frac{z^6+1}{2z^3}\cdot \frac{z}{(-2z^2+5z-2)}$$
$$=\frac{z^6+1}{2z^2(-2z^2+5z-2)}=-\frac{z^6+1}{4z^2(z^2-\frac{5}{2}z+1)}=-\frac{z^6+1}{4z^2(z-1/2)(z-2)}.$$
Thus by the change of variable,
$$\int_0^{2\pi} \frac{\cos(3\theta)}{5-4\cos(\theta)}\mathrm{d}\theta=\oint_{|z|=1} -\frac{z^6+1}{4z^2(z-1/2)(z-2)} \frac{\mathrm{d}z}{iz}$$
$$=-\frac{1}{4i}\oint_{|z|=1} \frac{z^6+1}{z^3(z-1/2)(z-2)} \mathrm{d}z.$$
Now obviously the poles of $f(z)=\frac{z^6+1}{z^3(z-1/2)(z-2)}$ are $z_0=0$, of order 3, and the simple poles $z_1=1/2$ and $z_2=2$. Only $z_0,z_1\in int \,\gamma$ where $\gamma=\{z\in \mathbb{C} : |z|=1\}$ (and $int \cdot$ is the interior of a set) thus by the Cauchy-residue theorem, we have
$$\oint_{|z|=1} \frac{z^6+1}{z^3(z-1/2)(z-2)} \mathrm{d}z=2\pi i (Res(f,0)+Res(f,1/2)).$$
Now
$$Res(f,0)=\frac{1}{2!} \lim_{z\to 0}\frac{\mathrm{d}^2}{\mathrm{d}z^2}z^3f(z)=\frac{1}{2}\lim_{z\to 0}\frac{\mathrm{d}^2}{\mathrm{d}z^2}  \frac{z^6+1}{(z-1/2)(z-2)}=\frac{21}{2}$$
by an elementary yet tedious calculus computation. I used wolfram alpha to be honest. Next,
$$Res(f,1/2)=\lim_{z\to 1/2} (z-1/2)f(z)=\lim_{z\to 1/2}  \frac{z^6+1}{z^3(z-2)}=\frac{(1/2)^6+1}{(1/8)(-3/2)}=-\frac{65}{12}$$
Thus
$$\oint_{|z|=1} \frac{z^6+1}{z^3(z-1/2)(z-2)} \mathrm{d}z=2\pi i\frac{61}{12}.$$
But,
$$\int_0^{2\pi} \frac{\cos(3\theta)}{5-4\cos(\theta)}\mathrm{d}\theta=-\frac{1}{4i}\oint_{|z|=1} \frac{z^6+1}{z^3(z-1/2)(z-2)} \mathrm{d}z$$
$$=-\frac{1}{4i}2\pi i\frac{61}{12}=-\frac{61}{24}\pi.$$
However wolfram says the integral (in its original form) is equal to $\pi/12$. Where did I mess up? 
 [/INST] Community wiki answer so the question can be marked as answered:
As DavidP commented, the residue at $0$ is $\frac{21}4$. Apparently you forgot to multiply the Wolfram|Alpha result by the factor $\frac12$.
</s>