Integration of $\int_0^{\infty}\frac{e^{(\lambda +is)t}-e^{-(\lambda +is)t}}{e^{\pi t}-e^{-\pi t}}dt$

By 3.511.2 in Gradshteyn and Ryzhik, $$ \int_0^{ + \infty } {\frac{{\sinh (zt)}}{{\sinh (\pi t)}}dt} = \frac{1}{2}\tan \left( {\frac{z}{2}} \right) $$ provided $\left| z \right| < \pi$. Take $z=\lambda+is$.


An amusing way get the answer: first extend the integration range to $-\infty, \infty$. The integrand is even in $t$, so we get a $1/2$ factor up front. I'm taking $a=\lambda+is$.

$$ I(a)=\frac{1}{2}\int_{-\infty}^{\infty} dt \ \frac{e^{at}-e^{-at}}{e^{\pi t}-e^{-\pi t}}$$

The integrand has poles at $t=in$, $n \in Z $. The pole at $t=0$ is a removable singularity. An anticlockwise contour$^\dagger$ in the complex $t$ plane will enclose all the residues for $n=1,2,3,..$, which are in the upper half plane. Courtesy of the residue theorem, we have

$$ I(a)= \sum_{n=1}^{\infty}R_n $$

$$ R_n = 2\pi i \lim_{t \rightarrow in} (t-in) \frac{1}{2} \frac{e^{at}-e^{-at}}{e^{\pi t}-e^{-\pi t}} $$

$$ R_n =-(-1)^n \sin{(na)} $$

The sum for $I(a)$ may be performed by writing $\sin$ in exponential form and doing the two geometric sums$^\ddagger$.

$$ R_n=-\frac{1}{2i}\left[ (-e^{ia})^n- (-e^{-ia})^n \right]$$

For which we get

$$ I(a)= -\frac{1}{2i} \left[ \frac{-e^{ia}}{1+e^{ia}} - \frac{-e^{-ia}}{1+e^{-ia}} \right]$$

After simplification, this yields

$$ I(a)= \frac{1}{2} \tan \left( \frac{a}{2} \right)$$

$$\tag*{$\blacksquare$}$$

Clearly, this converges for $-\pi <a<\pi$ due to the nearest singularities in $\tan$ at $\pm \pi/2$.

$\dagger$ Along the real axis then closed in the upper plane.

$\ddagger$ As mentioned in the comments, these individual sums are divergent. Don't worry! Either we can sum $-(-1)^n \sin(na)$ directly, or regularize the individual sums. For instance, using Euler summation

$$ E_1(x)= - \sum_{n=1}^{\infty} x^n (-e^{ia})^n=\frac{xe^{ia}}{1+xe^{ia}}$$

$$ E_2(x)= - \sum_{n=1}^{\infty} x^n (-e^{-ia})^n=\frac{x}{x+e^{ia}}$$

Which converge for $x$ sufficiently small. We then have

$$I(a)= \lim_{x \rightarrow1} (E_1(x)-E_2(x))$$

Which leads to the same answer.