TITLE: Prove that $\int_{-\infty}^\infty \frac {\sin t \tau}{e^{t/2}-e^{-t/2}}\,dt = \pi \tanh \pi \tau$
QUESTION [8 upvotes]: Let $f_\tau(t)=\frac {\sin t \tau}{e^{t/2}-e^{-t/2}}$ and show that $I :=\int_{-\infty}^\infty f_\tau(t)\,dt = \pi \tanh \pi \tau$.
My attempt:
Consider the integral $\int_R f_\tau(t)\,dt$ over a large rectangle $R$ over the complex numbers going from $-K$ to $K$ to $K+4\pi i$ to $-K+4\pi i$ to $-K$ and let $K\rightarrow \infty$.
Since $f_\tau(t)$ has poles at $0, 2\pi i, 4\pi i$, we have that $$\int_R f_\tau(t)\,dt = \frac 1 2(\operatorname{res}_{0}f_\tau(t) + \operatorname{res}_{4\pi i}f_\tau(t)) + \operatorname{res}_{2\pi i}f_\tau(t).$$
Since the integrals over the vertical sides go to zero,
$$I - \int \frac {e^{-4\pi \tau}e^{it\tau}-e^{4\pi\tau}e^{-it\tau}}{e^{t/2}-e^{-t/2}}\,dt=\frac 1 2(\operatorname{res}_{0}f_\tau(t) + \operatorname{res}_{4\pi i}f_\tau(t)) + \operatorname{res}_{2\pi i}f_\tau(t).$$
Moreover,
$$\operatorname{res}_{0}f_\tau(t) = \lim_{t\rightarrow 0}\,(t-0)\frac{\sin t\tau}{e^{t/2}-e^{-t/2}} = 0.$$
If I am on the right path, I'd like to ask for a hint for the calculation of the other two residues and the integral over the top of the rectangle.

REPLY [5 votes]: For a rectangular-like contour, consider 
$$\oint_C dz \frac{\sin{\tau z}}{\sinh{(z/2)}} $$
where $C$ is the rectangle with vertices $-R$, $R$, $R+i 2 \pi$, $-R+i 2 \pi$, modified by a semicircular detour around  $z=i 2 \pi$ of radius $\epsilon$.  The contour integral is therefore
$$\int_{-R}^R dx \frac{\sin{\tau x}}{\sinh{(x/2)}} + i \int_0^{2 \pi} dy \frac{ \sin{\tau (R+i y)}}{\sinh{((R+i y)/2)}} \\ - PV \int_{-R}^R dx \frac{\sin{\tau (x+i 2 \pi)}}{\sinh{(x/2+i \pi)}} + i \epsilon \int_{2 \pi}^{\pi} d\phi \, e^{i \phi} \frac{\sin{\tau (\epsilon e^{i \phi}+ i 2 \pi)}}{\sinh{(\epsilon e^{i \phi}/2+i \pi)}} \\- i \int_0^{2 \pi} dy \frac{ \sin{\tau (-R+i y)}}{i \sinh{((-R+i y)/2)}} $$
In the limit as $R \to \infty$ the second and fifth integrals vanish.  The contour integral then becomes in this limit and the limit $\epsilon \to 0$,
$$\left [1+\cosh{(2 \pi \tau)} \right ]  \int_{-\infty}^{\infty} dx \frac{\sin{\tau x}}{\sinh{(x/2)}} + i \sinh{(2 \pi \tau)} PV \int_{-\infty}^{\infty} dx \frac{\cos{\tau x}}{\sinh{(x/2)}} - 2 \pi \sinh{2 \pi \tau} $$
The integral over cosine vanishes due to symmetry.  Further, by Cauchy's theorem, the contour integral vanishes.  Thus,

$$\int_{-\infty}^{\infty} dx \frac{\sin{\tau x}}{\sinh{(x/2)}} = 2 \pi \frac{\sin{2 \pi \tau}}{1+\cos{2 \pi \tau}} = 2 \pi \tanh{\pi \tau}$$

The stated result follows.