<s>[INST] Help me out with the sum $\sum_{n= 0}^{N-1} \frac{ \left(a-b \cos{\left(\frac{2 \pi n}{N} \right)} \right)^2}{a^2 + b^2 -2ab\cos{\frac{2\pi n}{N}}}$ I am trying to find an analytical expression for the summation below
$$
\sum_{n= 0}^{N-1} \frac{ \left(a-b \cos{\left(\frac{2 \pi n}{N} \right)} \right)^2}{a^2 + b^2 -2ab\cos{\frac{2\pi n}{N}}}
$$
with $a>b$.
By trying it in MATLAB, I found that for large  $N$ it gives a number which is
proportional to $N$. Therefore I am certain there must be analytical solution for this summation.
Can anyone help out?
Thank you
 [/INST] My method gets the wrong answer, which may be because I approximate it at the start by an integral.
$$\int_0^N \frac{(a-b\cos(2\pi n/N))^2}{a^2+b^2-2ab\cos(2\pi n/N)}dn$$
Substitute $z=\exp(2\pi i n/N)$ to get 
$$\frac N{2\pi i}\oint\frac{(a-(z+z^{-1})b/2)^2} {a^2+b^2-ab(z+z^{-1})}\frac{dz}z\\
=\frac N{8\pi i}\oint\frac{(2az-b(z^2+1))^2}{(az-b)(a-bz)}\frac{dz}{z^2}$$
This has poles at $0$, $b/a$ and $a/b$, and the integral is around the unit circle.  The residue at $b/a$ is $1-b^2/a^2$, and at $0$ is $3-b^2/a^2$, so the final answer is 
$$\frac N4(4-2b^2/a^2)$$
The other solutions had $a^N-b^N$ in the denominator.  I lost that when I approximated the sum by an integral.
</s>