Evaluating the integral $\int_0^{\infty} \frac{\sin(x)}{\sinh(x)}\,dx$ I was trying to evaluate the following integral,
 $$I=\int_\limits {-\infty}^{\infty} \dfrac{\sin(x)}{\sinh(x)}\,dx$$  but had no success. I first expanded the the hyperbolic sine:
$$I=2\int_\limits {-\infty}^{\infty} \dfrac{\sin(x)}{e^{x}-e^{-x}}\,dx=2\Im \int_\limits {-\infty}^{\infty} \dfrac{e^{ix}}{e^{x}-e^{-x}}\,dx$$
I then substituted $u=e^x$,
$$I=2\Im\int_\limits {0}^{\infty} \dfrac{u^i}{u^2-1}\,du$$
Now, I'm not really sure what to do. Also, after exchanging the $\Im$ with the integral seemed to create a non-integrable singularity at $u=1$. When can you not do that?
 A: Here is a solution using something akin to the OP's method. We will show that
$$\int_0^\infty \frac{x^a-x^{-a}}{x^2-1}dx = \pi \tan\left(\frac{\pi a}{2}\right)$$
From which the OP's integral is immediate. To do so, we will first evaluate the following integral using complex analysis:
$$\int_0^\infty \frac{x^a}{x^2-1}dx$$
Given $-1 < \text{Re}(a) < 1$ with $a \neq 0$, we let $\Gamma$ be the following contour.

Note that the integrals on $C_r$ and $C_R$ vanish as $r \to 0^+$ and $R \to \infty$ respectively by standard $ML$ estimates. Due to choosing the logarithm to have a branch cut on the positive real line, the $x^a$ in the numerator affects the integral on the positive real line, giving
$$\left(\int_R^{1+r} + \int_{1-r}^r\right)f(z)dz = -e^{2\pi ia}\left(\int_r^{1-r} + \int_{1+r}^R\right)f(z)dz\tag{1}$$
By similar reasoning, we find that $$\int_{S_r^-}f(z)dz = e^{2\pi ia}\int_{S_r^+}f(z)dz \tag{2}$$
The integral of $f$ over $S_r^+$ will simply be
$$\int_{S_r^+}f(z)dz = -\pi i \operatorname{Res}(1) = - \pi i \lim_{z \to 1} \frac{x^a}{x+1} = \frac{\pi i}{2} \tag{3}$$
Finally, by the residue theorem, the integral of $f$ on $\Gamma$ will simply be $2\pi i \sum \text{Res}(f)$, giving
$$\int_\Gamma f(z)dz = 2\pi i \operatorname{Res}(-1) = 2 \pi i \lim_{z \to -1}\frac{e^{a\mathcal{L}_0(z)}}{x-1} = -\pi i e^{a \pi i}\tag{4}$$
Thus, by combining $(1), (2), (3),$ and $(4)$ above, we get
$$
(1-e^{2\pi ia})\left(\int_r^{1-r} + \int_{1+r}^R\right)f(z)dz + (1+e^{2\pi ia})\int_{S_r^+}f(z)dz = \int_{\Gamma}f(z)dz
$$
So that
$$\int_0^\infty \frac{x^a}{x^2-1} = \left(\int_r^{1-r} + \int_{1+r}^R\right)f(z)dz = \frac{\frac{\pi i}{2}(1+e^{2\pi ia})-\pi i e^{a \pi i}}{1-e^{2\pi ia}} = \frac{\pi}{2}\tan\left(\frac{\pi a}{2}\right)$$
Where the last step follows from rearranging the expression into the complex form of $\tan(z)$. Thus we have
$$\begin{align}
\int_0^\infty \frac{x^a-x^{-a}}{x^2-1}dx
&= \int_0^\infty \frac{x^a}{x^2-1}dx - \int_0^\infty \frac{x^{-a}}{x^2-1}dx
\\&=\frac{\pi}{2}\tan\left(\frac{\pi a}{2}\right) - \frac{\pi}{2}\tan\left(\frac{-\pi a}{2}\right)
\\&= \pi \tan\left(\frac{\pi a}{2}\right)
\end{align}$$ 
Since $tan(z)$ is an odd function. Thus we immediately get the OP's integral by noting
$$\begin{align}
I&=\int_{-\infty}^{\infty} \frac{\sin(x)}{\sinh(x)}dx
\\&= \frac{1}{i}\int_{-\infty}^\infty\frac{e^{ix}-e^{-ix}}{e^x-e^{-x}}dx
\\&= \frac{1}{i}\int_0^\infty\frac{x^i-x^{-i}}{x^2-1}dx
\\&= \frac{\pi}{i} \tan\left(\frac{\pi i}{2}\right)
\\&= \pi \tanh\left(\frac{\pi}{2}\right)
\\&\text{As claimed.} \tag*{$\Box$}
\end{align}$$
A: \begin{align}
\int_0^\infty\dfrac{\sin x}{\sinh x}dx
&= \int_0^\infty\dfrac{2\sin x}{e^{x}-e^{-x}}dx \\
&= \int_0^\infty\dfrac{2e^{-x}\sin x}{1-e^{-2x}}dx \\
&= \int_0^\infty2e^{-x}\sin x\sum_{n\geq0}e^{-2nx} \\
&= \sum_{n\geq0}2\int_0^\infty e^{-(2n+1)x}\sin x \\
&= \sum_{n\geq0}\dfrac{2}{1+(2n+1)^2} \\
&= \color{blue}{\dfrac{\pi}{2}\tanh\dfrac{\pi}{2}}
\end{align}
where
$$\tanh z=2z\left(\dfrac{1}{z^2+(\frac{\pi}{2})^2}+\dfrac{1}{z^2+(\frac{3\pi}{2})^2}+\dfrac{1}{z^2+(\frac{5\pi}{2})^2}+\cdots\right)$$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
&\bbox[10px,#ffd]{%
2\int_{0}^{\infty}{\sin\pars{x} \over \sinh\pars{x}}\,\dd x} =
2\,\Im\int_{0}^{\infty}{\expo{\ic x} - 1 \over \pars{\expo{x} - \expo{-x}}/2}\,\dd x
\\[5mm] = &\
4\,\Im\int_{0}^{\infty}{\expo{-\pars{1 - \ic}x} - \expo{-x} \over 1 - \expo{-2x}}\,\dd x
\,\,\,\stackrel{\large\expo{-2x}\ =\ t}{\large =}\,\,\,
4\,\Im\int_{1}^{0}{t^{1/2 - \ic/2} - t^{1/2} \over 1 - t}\,
\pars{-\,{\dd t \over 2t}}
\\[5mm] = &\
2\,\Im\bracks{\int_{0}^{1}{1 - t^{-1/2} \over 1 - t}\,\dd t -
\int_{0}^{1}{1 - t^{-1/2 - \ic/2} \over 1 - t}\,\dd t}
\\[5mm] = &\
2\,\Im\bracks{\Psi\pars{1 \over 2} - \Psi\pars{{1 \over 2} - {\ic \over 2}}} =
-2\,\Im\Psi\pars{{1 \over 2} - {\ic \over 2}}
\\[5mm] = &\
-2\,{\Psi\pars{1/2 - \ic/2} - \Psi\pars{1/2 + \ic/2} \over 2\ic}
=
\ic\braces{\pi\cot\pars{\pi\bracks{{1 \over 2} + {\ic \over 2}}}}
\\[5mm] = &\
-\ic\pi\tan\pars{\pi\ic \over 2} =
\bbx{\pi\tanh\pars{\pi \over 2}}
\end{align}
