Evaluate the Integral \(\int_{-\infty}^{\infty} \frac{\sin(ax)}{\mathrm{e}^{x/2}-\mathrm{e}^{-x/2}}\mathrm{d}x\)

How to prove
\begin{equation}
I=\int\limits_{-\infty}^{\infty} \frac{\sin(ax)}{\mathrm{e}^{x/2}-\mathrm{e}^{-x/2}}\mathrm{d}x = \pi \tanh(\pi a)
\tag{1}
\label{eq:sinsinh-1}
\end{equation}

was a question on Mathematics Stack Exchange. I will provide a solution similar to one at MSE but more fully worked out. Also, I will show an interesting relation between the digamma function and the tangent function due to another solution at MSE.

\begin{align}
I &= -i \int\limits_{0}^{\infty} \frac{\mathrm{e}^{iax}-\mathrm{e}^{-iax}}{\mathrm{e}^{x/2}-\mathrm{e}^{-x/2}}\mathrm{d}x \\
&= -i \int\limits_{0}^{\infty} \mathrm{e}^{-x/2} \frac{\mathrm{e}^{iax}-\mathrm{e}^{-iax}}{1-\mathrm{e}^{-x}}\mathrm{d}x \\
&= -i \int\limits_{0}^{\infty} \mathrm{e}^{-x/2} \left( \mathrm{e}^{iax}-\mathrm{e}^{-iax} \right) \sum\limits_{n=0}^{\infty} \mathrm{e}^{-nx}\mathrm{d}x \\
&= -i \int\limits_{0}^{\infty} \Big[\sum\limits_{n=0}^{\infty} \mathrm{e}^{-x(1/2+n-ia)} \,-\, \sum\limits_{n=0}^{\infty} \mathrm{e}^{-x(1/2+n+ia)} \Big] \mathrm{d}x \\
\tag{2}
\label{eq:sinsinh-2}
&= -i \Big[\sum\limits_{n=0}^{\infty} \frac{1}{1/2+n-ia} \,-\, \sum\limits_{n=0}^{\infty} \frac{1}{1/2+n+ia}\Big] \\
&= 2a \sum\limits_{n=0}^{\infty} \frac{1}{(n+1/2)^{2}+a^{2}}
\end{align}

The Mittag-Leffler expansion of the hyperbolic tangent function is
\begin{equation}
\tanh(z) = 2z \sum\limits_{n=0}^{\infty} \frac{1}{n^{2}(\pi/2)^{2}+z^{2}}
\tag{3}
\label{eq:sinsinh-3}
\end{equation}

For \(z=a\pi\) we have our final result
\begin{equation}
\int\limits_{-\infty}^{\infty} \frac{\sin(ax)}{\mathrm{e}^{x/2}-\mathrm{e}^{-x/2}}\mathrm{d}x = 2a \sum\limits_{n=0}^{\infty} \frac{1}{(n+1/2)^{2}+a^{2}} = \pi \tanh(\pi a)
\end{equation}

Now, let us examine equation \eqref{eq:sinsinh-2} and use it to recover a definition of the tangent in terms of the digamma function.

Using a series definition of the digamma function:
\begin{equation}
\psi(z) = -\gamma + \sum\limits_{n=0}^{\infty} \left( \frac{1}{n+1} – \frac{1}{n+z} \right)
\tag{4}
\label{eq:sinsinh-4}
\end{equation}
we have
\begin{equation}
\psi\left(\frac{1}{2}+ia\right) = -\gamma + \sum\limits_{n=0}^{\infty} \left( \frac{1}{n+1} – \frac{1}{(n+1/2)+ia} \right)
\tag{5a}
\label{eq:sinsinh-5a}
\end{equation}
and
\begin{equation}
\psi\left(\frac{1}{2}-ia\right) = -\gamma + \sum\limits_{n=0}^{\infty} \left( \frac{1}{n+1} – \frac{1}{(n+1/2)-ia} \right)
\tag{5b}
\label{eq:sinsinh-5b}
\end{equation}

Subtracting equation \eqref{eq:sinsinh-5b} from \eqref{eq:sinsinh-5a} and multiplying the result by \(-i\) yields equation \eqref{eq:sinsinh-2} which is equal to equation \eqref{eq:sinsinh-1}.

Making the substitution \(z=\frac{1}{2}+ia\) yields
\begin{align}
-i\big[\psi(z)-\psi(1-z)\big] &= \pi \tanh\Big[-i\pi\left(z-\frac{1}{2}\right)\Big] \\
&= -i \pi \tan\Big[\pi\left(z-\frac{1}{2}\right)\Big] \\
&= -i \pi \cot(\pi z)
\end{align}

Rearrangement yields
\begin{equation}
\psi(z)-\psi(1-z) = \frac{-\pi}{\tan(\pi z)}
\end{equation}
an expression which can be found here.