Evaluating $\sum_{k=-m}^{m}(-1)^k \, e^{-\frac{i\pi k}{m}}\frac{2\left(ze^{\frac{i\pi k}{m}}\right)^2}{\left(ze^{\frac{i\pi k}{m}}\right)^2 - q^2}$ From quite some time I'm struggling on proving that:
$$\sum_{k=-n}^{n}(-1)^k \, e^{-\frac{i\pi k}{m}}\dfrac{2\left(ze^{\frac{i\pi k}{m}}\right)^2}{\left(ze^{\frac{i\pi k}{m}}\right)^2 - q^2} = 2z^2m\,\dfrac{q^{m-1}z^{m-1}}{z^{2m} - q^{2m}} $$
where $m = 2n+1$. My intuition to prove this would be proving that the partial fraction expansion of the right-hand side coincides with the left-hand side. However I've no idea if that would get us anywhere. I'm looking for a real analytic proof but a proof using complex analysis and residue theorem would be most welcomed.
Any help or hints would be highly appreciated. Thanks for reading.
 A: We will prove the equality for $|z|<|q|.$ If two rational functions are equal on an open set, they are equal everywhere they are defined.
If $|y|<|q|$ then:
$$f(y)=\frac{2y^2}{y^2-q^2}=2+\frac{2q^2}{y^2-q^2}=2-2\sum_{j=0}^\infty \frac{y^{2j}}{q^{2j}}$$
Letting $u=e^{i\pi/m},$ your formula is:
$$\sum_{k=-n}^{n} (-1)^ku^{-k}f(zu^k)=\\
2\sum_{k=-n}^{n} (-1)^k u^{-k} - 2\sum_{j=0}^{\infty}\frac{z^{2j}}{q^{2j}}\sum_{k=-n}^n (-u^{2j-1})^k$$
First:
$$\sum_{k=-n}^{n} (-1)^ku^{-k}=(-u)^{n}\frac{1+u^{2n+1}}{1+u}=0,$$
since $u^{2n+1}=-1$ and $u\neq 1.$
When $-u^{2j-1}\neq 1,$ $$\sum_{k=-n}^n (-u^{2j-1})^k =(-u^{2j-1})^{-n}\frac{1+u^{m(2j-1)}}{1+u^{2j-1}}=0.$$
$u^{2j-1}=-1$ when $j\equiv n+1\pmod {m}.$ Then:
$$\sum_{k=-n}^n (-u^{2j-1})^k =2n+1=m.$$
So our sum is over the $j\equiv n+1\pmod {m}.$
$$\begin{align}m\sum_{j=0}^{\infty}\frac{z^{2(mj+n+1)}}{q^{2(mj+n+1)}}
&=m\frac{z^{2(n+1)}}{q^{2(n+1)}}\frac{q^{2m}}{q^{2m}-z^{2m}}\\
&=m\frac{z^{m+1}q^{m-1}}{q^{2m}-z^{2m}}
\end{align}$$
The last step because $2(n+1)=m+1.$
But going back, we have to multiply by $-2.$ We’ll change the sign in the denominator, yielding:
$$2m\frac{z^{m+1}q^{m-1}}{z^{2m}-q^{2m}}= 2z^2m\frac{z^{m-1}q^{m-1}}{z^{2m}-q^{2m}} $$
Two rational functions which are equal on an open set, here $|z|<|q|,$ then they are equal everywhere they are defined.
