How to calculate this integral via residues. I get into trouble in evaluating this integral:
$$
C(a)=\frac{1}{i\beta}\int_\Gamma \cot\frac{\pi z}{\beta}\frac{1}{\sin^2\frac{z}{2}}dz
$$
where the contour $\Gamma$ consists of two vertical lines, (−π − i∞, −π + i∞) and
(π + i∞,π − i∞).The result is:
$$
-\frac{2}{3}((\frac{2\pi}{\beta})^2-1)
$$
The integral can be evaluated via residues. Could show me how to do that integral?
Thanks a lot!
 A: We begin with the contour integral 
$$C(a)=\frac{1}{i\beta}\oint_\Gamma \frac{\cot\frac{\pi z}{\beta}}{\sin^2\frac{z}{2}}dz$$
where for $|\beta|>\pi$, the only singularity within $\Gamma$ is at $z=0$ (a pole of order three).  In order to calculate the residue at the origin, the following expansions are useful.
$$\begin{align}
\cos (\pi z/\beta)&=1-\frac12 (\pi z/\beta)^2+O(z^4) \tag 1\\\\
\sin^2(z/2)&=(z/2)^2\left(1-\frac{1}{12}z^2+O(z^4)\right) \tag 2\\\\
\sin(\pi z/\beta)&=(\pi z/\beta)\left(1-\frac16 (\pi z/\beta)^2+O(z^4)\right)\tag 3
\end{align}$$
Using $(1)-(3)$, we have the following expansion 
$$\begin{align}
\frac{\cot\frac{\pi z}{\beta}}{\sin^2\frac{z}{2}}&=\frac{\cos (\pi z/\beta)}{\sin^2(z/2)\sin(\pi z/\beta)}\\\\
&=\frac{1-\frac12 (\pi z/\beta)^2+O(z^4)}{(z/2)^2(\pi z/\beta)\left(1-\frac{1}{12}z^2+O(z^4)\right)\left(1-\frac16 (\pi z/\beta)^2+O(z^4)\right)}\\\\
&=\frac{1-\frac12 (\pi z/\beta)^2+O(z^4)}{(z/2)^2(\pi z/\beta)\left(1-\left(\frac{1}{12}+\frac{\pi^2}{6\beta^2}\right)+O(z^4)\right)}\\\\
&=\frac{\left(1-\frac12 (\pi z/\beta)^2+O(z^4)\right)\left(1+\left(\frac{1}{12}+\frac{\pi^2}{6\beta^2}\right)+O(z^4)\right)}{(z/2)^2(\pi z/\beta)}\\\\
&=\frac{1+\left(\frac1{12}-\frac{\pi^2}{3\beta^2}\right)z^2+O(z^4)}{(z/2)^2(\pi z/\beta)}\\\\
&=\frac{4\beta/\pi}{z^3}-\frac{(4\beta/\pi)\left(\frac1{12}-\frac{\pi^2}{3\beta^2}\right)}{z^1}+O(z)
\end{align}$$
Therefore, the residue of $\frac{\cot\frac{\pi z}{\beta}}{\sin^2\frac{z}{2}}$ at $z=0$ is given by 
$$\text{Res}\left(\frac{\cot(\pi z/\beta)}{\sin^2(z/2)},z=0\right)=(4\beta/\pi)\left(\frac1{12}-\frac{\pi^2}{3\beta^2}\right)$$
Finally, using the Residue Theorem, we obtain 
$$\bbox[5px,border:2px solid #C0A000]{\frac{1}{i\beta}\oint_\Gamma \frac{\cot\frac{\pi z}{\beta}}{\sin^2\frac{z}{2}}dz=2\pi i \frac{1}{i\beta}(4\beta/\pi)\left(\frac1{12}-\frac{\pi^2}{3\beta^2}\right)=-\frac23\left(\left(\frac{2\pi}{\beta}\right)^2-1\right)}$$
as was to be shown!

NOTE:
While the use of expansions can often facilitate analyses such as the one herein, we can also have used Cauchy's Integral Formula or here to calculate the residue as 
$$\text{Res}\left(\frac{\cot(\pi z/\beta)}{\sin^2(z/2)},z=0\right)=\frac1{2!} \lim_{z\to 0}\frac{d^2}{dz^2}\left(z^3\frac{\cot(\pi z/\beta)}{\sin^2(z/2)}\right)$$
