# summation of a doubly infinite series

I want to show that $\sum\limits_{n=-\infty}^{\infty} \frac{(-1)^{n}}{x + \pi n} = \csc x$.

If you let $f(z) = \frac{\pi \csc \pi z}{x + \pi z}$ and integrate around the square in the complex plane that has vertices at $(\pm 1 \pm i)(N+\frac{1}{2})$, the integral does not evaluate to zero when you let $N$ go to $\infty$ (at least I don't think it does). So that must not be the right contour for this problem.

-

First of all, the series as written does not converge absolutely, which makes doing many manipulations difficult. Thus, use the principal value: $$f(z)=\frac1z+2z\sum_{n=1}^\infty\frac{(-1)^n}{z^2-\pi^2n^2}\tag{1}$$ Looking at $f$ as $\lim\limits_{N\to\infty}\sum\limits_{n=-N}^N \frac{(-1)^{n}}{z + \pi n}$ yields that $f$ is $2\pi$-periodic: \begin{align} &f(z+2\pi)-f(z)\\ &=\lim_{N\to\infty}\left(\frac{(-1)^{N-1}}{z+\pi(N+1)}+\frac{(-1)^N}{z+\pi(N+2)}-\frac{(-1)^{-N}}{z-\pi N}-\frac{(-1)^{-N+1}}{z-\pi(N-1)}\right)\\ &=0\tag{2} \end{align} Pairing up odd and even terms and taking the limit as $\operatorname{Im}(z)\to\pm\infty$ \begin{align} \lim f(z) &=\frac1z+2z\sum_{n=1}^\infty\frac{(-1)^n}{z^2-\pi^2n^2}\\ &=\frac1z+2z\sum_{n=1}^\infty\frac{4\pi^2n-\pi^2}{(z^2-4\pi^2n^2)(z^2-4\pi^2n^2+4\pi^2n-\pi^2)}\\ &=\frac1z+\frac2z\sum_{n=1}^\infty\frac{(4\pi^2n-\pi^2)/z\;1/z}{(1-4\pi^2n^2/z^2)(1-(4\pi^2n^2+4\pi^2n-\pi^2)/z^2)}\\ &=\frac1z-\frac2z\int_0^\infty\frac{4\pi^2t\;\mathrm{d}t}{(1+4\pi^2t^2)^2}\\ &=0\tag{3} \end{align}
Next, notice that the poles all match up and have the same residue. Thus, $f(z)-\csc(z)$ has no poles.
Therefore, $f(z)-\csc(z)$ is $2\pi$-periodic, has no poles, and $\lim\limits_{\operatorname{Im}(z)\to\pm\infty}f(z)-\csc(z)=0$ implies $f(z)-\csc(z)$ is bounded. By Liouville's Theorem, $f(z)-\csc(z)$ is a constant, which must be $0$.
Thus, $$\frac1z+2z\sum_{n=1}^\infty\frac{(-1)^n}{z^2-\pi^2n^2}=\csc(z)\tag{4}$$