TITLE: Fourier series of $\frac{1}{5+4 \cos x}$ using contour integration
QUESTION [5 upvotes]: The function 
$$f(x)=\frac{1}{5+4 \cos x}$$
is periodic with the main period being $T=2\pi$. The graph is easily obtained, but here is a graph from Desmos as it looks better: 
The function is even, so all the coefficients $b_{n}$ vanish: $$b_{n}=\frac{2}{t}\int_{-T/2}^{T/2} f(x)\sin\left ( \frac{2n\pi x}{T} \right )\,dx=0.$$ 
Using the residue theorem I found that 
$$a_0 = \frac{2}{T} \int_{-T/2}^{T/2} f(x)\,dx = 
\frac{1}{\pi i}\oint \frac{dz}{5z+2z^2+2}=\frac{2}{3}$$
and also 
$$a_{n}=\frac{1}{2\pi i }\oint \frac{z^{2n}+1}{z^{n}(5z+2+2z^2)}\, dz = \operatorname*{Res}\limits_{z=-1/2} f(z)+ \operatorname*{Res}\limits_{z=0} f(z).$$
Furthermore
$$\operatorname*{Res}\limits_{z=-1/2} f(z) = \frac{1+\left ( \frac{-1}{2} \right )^{n}}{3\left ( \frac{-1}{2} \right )^{n}}.$$
The residue at $z=0$ isn't so easily obtained since there is a pole of order $n$, and when doing Laurent expansion it gets too messy and it seems that the coefficient $A_{-1}$ may not be easily derived  from there. How do I effectively find that residue?

REPLY [3 votes]: I suggest that you write
$$
\frac{1}{2+5z+2z^2}=\frac{1}{(2+z)(1+2z)}=\frac{2}{3}\frac{1}{1+2z}-\frac{1}{6}\frac{1}{1+z/2}.
$$
Next, since $n$ is positive, the term $z^{2n}$ can be neglected (it will never contribute to the $z^{-1}$ coefficient in the Laurent expansion). Thus
$$
\begin{aligned}
\text{Res}_{z=0}f(z)&=\text{Res}_{z=0}\frac{1}{z^n}\Bigl(\frac{2}{3}\frac{1}{1+2z}-\frac{1}{6}\frac{1}{1+z/2}\Bigr)
\end{aligned}
$$
Now you only need to turn the geometric series around (using
$$
\frac{1}{1+a}=1-a+a^2-a^3+\cdots)
$$
and find the necessary coefficient in front of $z^{-1}$. I leave it for you to do the details. 
Spoiler with result below:

 I get, as a result, $$\text{Res}_{z=0}f(z)=(-1)^n\frac{1-4^n}{3\cdot 2^n}.$$