Using the residue theorem to evaluate $\sum_\limits{n=-\infty}^{\infty} \frac{e^{in \alpha}}{(n-\beta)^{2}+\gamma^{2}}$ I would like to know how to sum up to following series (from the Gradshteyn-Ryzhik tables):
$$\sum_{n=-\infty}^\infty\frac{e^{in\alpha}}{(n-\beta)^2+\gamma^2}=\frac{\pi}{\gamma}\frac{e^{i\beta(\alpha-2\pi)}\sinh(\gamma\alpha)+e^{i\beta\alpha}\sinh[\gamma(2\pi-\alpha)]}{\cosh(2\pi\gamma)-\cos(2\pi\beta)}$$
with $0\leq\alpha\leq2\pi$. In the special case of $\alpha=0$, we have $$\sum_{n=-\infty}^\infty\frac1{(n-\beta)^2+\gamma^2}=\frac{\pi}{\gamma}\frac{\sinh[ 2\pi\gamma]}{\cosh(2\pi\gamma)-\cos(2\pi\beta)}$$ and I now that I can use the function $$ \frac{\cot(\pi z)}{(z-\beta)^2+\gamma^2}$$ to sum up this series via the residue theorem. 
In more detail, the singularities are $\beta\pm {\rm i}\gamma$ and $z_n=n$, $n\in\mathbb{N}$.
If I sum the corresponding residues, I get what the above result (for $\alpha=0$).
I am not sure, however:
1) How to choose the contour in order to have a correct argumentation?
2) What to do with the general case $\alpha\neq 0$?
 A: Let $C_{N}$ be a rectangular contour with vertices at $\pm \left(N+ \frac{1}{2} \right) \pm iN$, where $N$ is some large integer.
Also assume that $\gamma >0$.
Due to the fact that $e^{i z \alpha} , \, \alpha >0$, is unbounded in the lower half-plane, the kernel $\pi \cot(\pi z)$ is not particularly useful for evaluating Fourier series. 
Instead we use the modified  kernel $g(z) = \pi \left( \cot(\pi z)-i\right)= \pi e^{-i \pi z} \csc(\pi z)$.
Like $\pi \cot (\pi z)$, $g(z)$ has simple poles at the integers with residue $1$. And both functions are periodic in the real direction. 
But as $\operatorname{Im}(z) \to - \infty$, $ \left|g(z) \right|$ decays  to zero like $ 2 e^{2 \pi \operatorname{Im}(z)}$.
So as long as $\alpha \ge0$ and $2 \pi - \alpha \ge 0 $ (i.e., $0 \le \alpha \le 2 \pi$), the contour integral $$\int_{C_{N}} f(z) \, dz = \int_{C_{N}} \frac{\pi e^{-i \pi z} \csc(\pi z)e^{iz \alpha} }{(z- \beta)^{2}+ \gamma^{2}} \, dz $$will vanish as $N \to \infty$ through the positive integers.
Applying the residue theorem, we get $$\sum_{n=-\infty}^{\infty} \frac{e^{in\alpha}}{(n-\beta)^2+\gamma^2} + \text{Res} [f(z), \beta + i \gamma] + \text{Res} [f(z), \beta - i \gamma] = 0, $$ 
where 
$$ \begin{align}\text{Res} [f(z), \beta + i \gamma] &=\lim_{z \to \beta + i \gamma} \frac{\pi e^{-i \pi z} \csc(\pi z) e^{iz \alpha}}{2(z-\beta)} \\ &= \frac{\pi e^{-i \pi \beta}e^{\pi \gamma}}{2 i \gamma} \frac{e^{i \beta \alpha} e^{- \alpha \gamma}}{\sin(\pi \beta)\cosh(\pi \gamma)+ i \cos(\pi \beta) \sinh(\pi \gamma)} \\ &= \frac{\pi e^{i \beta(\alpha - \pi)} e^{\gamma(\pi - \alpha)}}{2 i \gamma} \frac{\sin(\pi \beta) \cosh(\pi \gamma) - i \cos(\pi \beta) \sinh(\pi \gamma)}{\sin^{2}(\pi \beta) \cosh^{2}(\pi \gamma) + \cos^{2}(\pi \beta) \sinh^{2}(\pi \gamma)} \\ &= -\frac{\pi e^{i \beta(\alpha - \pi)} e^{\gamma(\pi - \alpha)}}{2 \gamma} \frac{\cos(\pi \beta) \sinh(\pi \gamma) + i\sin(\pi \beta) \cosh(\pi \gamma)  }{\cosh^{2}(\pi \gamma) - \cos^{2}(\pi \beta)} \\ &= -\frac{\pi e^{i \beta(\alpha - \pi)} e^{\gamma(\pi - \alpha)}}{\gamma} \frac{\cos(\pi \beta) \sinh(\pi \gamma) + i\sin(\pi \beta) \cosh(\pi \gamma)  }{\cosh(2 \pi \gamma) - \cos(2 \pi \beta)} \end{align}$$
and 
$$ \begin{align} \text{Res} [f(z), \beta - i \gamma] &=\lim_{z \to \beta - i \gamma} \frac{\pi e^{-i \pi z} \csc(\pi z) e^{iz \alpha}}{2(z-\beta)} \\ &= -\frac{\pi e^{i \beta(\alpha - \pi)} e^{\gamma(\alpha-\pi)}}{\gamma} \frac{\cos(\pi \beta) \sinh(\pi \gamma) - i\sin(\pi \beta) \cosh(\pi \gamma)}{\cosh(2 \pi \gamma) - \cos(2 \pi \beta)}. \end{align}$$
Therefore,
$$ \begin{align} &\sum_{n=-\infty}^{\infty} \frac{e^{in\alpha}}{(n-\beta)^2+\gamma^2} \\ &= \frac{2 \pi e^{i \beta(\alpha-\pi)}}{\gamma} \frac{\cosh \left(\gamma(\pi - \alpha)\right) \cos(\pi \beta) \sinh(\pi \gamma)+i \sinh\left(\gamma(\pi - \alpha ) \right) \sin(\pi \beta) \cosh(\pi \gamma)}{\cosh(2 \pi \gamma) - \cos(2 \pi \beta)} \\ &= \frac{\pi}{\gamma} \frac{ e^{i \beta(\alpha-\pi)}}{\cosh(2 \pi \gamma) - \cos(2 \pi \beta)}\Big( \sinh (2 \pi \gamma) \cosh (\gamma \alpha)\cos(\pi \beta)- 2\sinh^{2}(\pi \gamma) \sinh(\gamma \alpha) \cos(\pi \beta) \\ & + i\sinh(2 \pi \gamma) \cosh(\gamma \alpha) \sin(\pi \beta) - 2i\cosh^{2} (\pi \gamma) \sinh(\gamma \alpha) \sin(\pi \beta) \Big) \\&= \frac{\pi}{\gamma} \frac{ e^{i \beta(\alpha-\pi)}}{\cosh(2 \pi \gamma) - \cos(2 \pi \beta)} \Big(\sinh \left(\gamma(2 \pi - \alpha) \right)e^{i \pi \beta} + \sinh(\gamma \alpha) e^{-i \pi \beta} \Big) \\ &= \frac{\pi}{\gamma} \frac{e^{i\beta(\alpha - 2 \pi)} \sinh(\gamma \alpha) +e^{i \beta \alpha} \sinh \left(\gamma(2 \pi - \alpha) \right) }{\cosh(2 \pi \gamma) - \cos(2 \pi \beta)}. \end{align}$$
A: Let
$$f(a) = \sum_{n=-\infty}^{\infty} \dfrac{e^{i(n-b)a}}{(n-b)^2+c^2}$$
We then have
$$f''(a) = \sum_{n=-\infty}^{\infty} \dfrac{-(n-b)^2e^{i(n-b)a}}{(n-b)^2+c^2}$$
Hence,
$$f''(a) - c^2f(a) = -\sum_{n=-\infty}^{\infty}e^{i(n-b)a} = -e^{-iba}\sum_{n=-\infty}^{\infty} e^{ina} = -e^{-iba}\pi \delta(a) + \dfrac12e^{-iba}$$
This gives us
$$f(a) = c_1\sinh\left(c(2\pi-a)\right) + c_2e^{-i2ab}\sinh\left(ca\right)$$ To obtain $c_1$ and $c_2$, we have
$f(0) = f(2\pi) = e^{-iba}\dfrac{\pi}c \dfrac{\sinh(2\pi c)}{\cosh(2\pi c)-\cosh(2\pi b)}$
