Evaluate the Integral using Contour Integration (Theorem of Residues) $$
J(a,b)=\int_{0}^{\infty }\frac{\sin(b x)}{\sinh(a x)} dx
$$
This integral is difficult because contour integrals normally cannot be solved with a sin(x) term in the numerator because of singularity issues between the 1st quadrant to the 2nd quadrant in the upper half circle of the contour.  
I've assumed:
$$
\sin(bx)=e^{ibz}
$$
since it effectively IS the sine term in the upper half circle.  
I've also used the following substitutions:
$$
x=z  ;  z=re^{i\theta}   ;  z=\cos(\theta)+i\sin(\theta)
$$
From what I understand, the x range has to include all values somehow.
When I plug in the substitutions and the Euler forms of sin and sinh, the integral becomes:
$$
2\int_{-\infty }^{\infty }\frac{e^{ibx}}{e^{ax}-e^{ax}}dx
$$
Have I screwed up the subs?  Did I reduce incorrectly?  Not sure what to go from here. If anyone could help shed some light it would be very much appreciated.  
 A: Note first that the integrand is even and can be extended to the entire real line.  Consider 
$$f(z) = \frac{e^{i b z}}{\sinh{a z}}$$
$b>0$, in the upper half complex plane.  Then
$$\oint_C dz \: \frac{e^{i b z}}{\sinh{a z}}$$
is equal to $i 2 \pi$ times the sum of the residues within $C$, which we'll take to be a semicircle of large radius in the upper half plane indented at the origin to include the pole at $z=0$.  The integral about the semicircular arc goes to zero as this radius goes to infinity because of Jordan's Lemma.  Then the integral of $f$ along the real line is the sum of the residues within $C$.
$\sinh{a z}$ has poles at $z=i n \pi/a$, $n \ge 0$.    The residue term here is a little tricky, but may be shown to be equal to 
$$\text{Res}_{z=i n \pi/a} f(z) = \frac{(-1)^n}{a} e^{-n \pi b/a}$$  
The integral along the real line is then the sum of all the residues within $C$:
$$\int_{-\infty}^{\infty} dx \: \frac{e^{i b x}}{\sinh{a x}} =\frac{i 2 \pi}{a} \sum_{n=0}^{\infty} (-1)^n e^{-n \pi b/a} = \frac{i 2 \pi}{a} \frac{1}{1+e^{-\pi b/a}}$$
For the case $b<0$, we use a contour in the lower half plane but indented to exclude the pole at $z=0$ (which was already included before); the result is:
$$\int_{-\infty}^{\infty} dx \: \frac{e^{-i b x}}{\sinh{a x}} =\frac{i 2 \pi}{a} \sum_{n=1}^{\infty} (-1)^n e^{-n \pi b/a} = -\frac{i 2 \pi}{a} \frac{1}{1+e^{\pi b/a}}$$
Then we take $1/2$ the sum to get the integral over the positive reals:
$$\int_{0}^{\infty} dx \: \frac{\sin{b x}}{\sinh{a x}} = \frac{\pi}{2 a} \tanh{\left(\pi \frac{b}{2 a}\right)}$$
A: You can change the integration $\int_{0}^{\infty}$ to $\frac{1}{2}\int_{-\infty}^{\infty}$ . Since $\cos$ part will disappear, 
Rewrite the integrand as
$$
\frac{e^{ibx}}{e^{ax}-e^{-ax}}=\frac{\exp\{(a+ib)x\}}{\exp(2ax)-1}
$$
Take the contour $[-R,R]$, $[R,R+\frac{i\pi}{a}]$, $[R+\frac{i\pi}{a},-R+\frac{i\pi}{a}]$, $[-R+\frac{i\pi}{a}, -R]$. (We will take $R\rightarrow\infty$). 
However the integrand has singularities at $x=0$ and $x=\frac{i\pi}{a}$, so detour those points by taking upper half circle of small radius $\epsilon$ at $x=0$, and lower half circle of small radius $\epsilon$ at $x=\frac{i\pi}{a}$. Then the contour does not have singularities inside. (We will take $\epsilon\rightarrow 0$). 
Note that the integrals on the vertical sides and the small part of the horizontal lines around $0$ and $\frac{i\pi}{a}$  will vanish with $R\rightarrow\infty$ and $\epsilon\rightarrow 0$.  
Denote the integral by $I=\int_{-\infty}^{\infty}\frac{e^{ibx}}{e^{ax}-e^{-ax}}dx$. Then by Residue Theorem, we have
$$
I-I\exp\{(a+ib)\frac{i\pi}{a}\}-\frac{1}{2}2\pi i \frac{1}{2a}-\frac{1}{2}2\pi i\frac{1}{2a}\exp\{(a+ib)\frac{i\pi}{a}\}=0
$$
We solve this for $I$, it now follows that 
$$
J(a,b)=\int_{0}^{\infty }\frac{\sin(b x)}{\sinh(a x)} dx=-iI=\frac{\pi}{2a}\frac{1-\exp(-\frac{b}{a}\pi)}{1+\exp(-\frac{b}{a}\pi)}
$$
and this RHS is the integral that we wanted in the beginning. 
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{\on}[1]{\operatorname{#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}
\on{J}\pars{a,b} & \equiv
\bbox[5px,#ffd]{\int_{0}^{\infty }{\sin\pars{bx} \over \sinh\pars{ax}}\,\dd x} =
\on{sgn}\pars{a}\int_{0}^{\infty }{\sin\pars{bx} \over \sinh\pars{\verts{a}x}}\,\dd x
\\[5mm] & \stackrel{x\ =\ t/\pars{2\verts{a}}}{=}\,\,\,
\left.{1 \over 2a}\int_{0}^{\infty }{\sin\pars{\beta t/2} \over \sinh\pars{t/2}}\,\dd t
\,\right\vert_{\,\ds{\beta\ \equiv\ b/\verts{a}}}
\\[5mm] & =
-\,{\ic \over 2a}\int_{0}^{\infty }
{\expo{-\pars{1 - \beta\,\ic}t/2}\,\,\, -\,
\expo{-\pars{1 + \beta\,\ic}t/2} \over 1 - \expo{-t}}\,\dd t
\\[5mm] & =
-\,{\ic \over 2a}\left[%
\int_{0}^{\infty }
{1 - \expo{-\pars{1 + \beta\,\ic}t/2} \over 1 - \expo{-t}}
\,\dd t\right.
\\[2mm] & \phantom{-\,{\ic \over 2a}\,\,\,\,\,}\left.
-\int_{0}^{\infty }
{1 - \expo{-\pars{1 - \beta\,\ic}t/2} \over 1 - \expo{-t}}
\,\dd t\right]\label{1}\tag{1}
\\[5mm] & =
-\,{\ic \over 2a}\bracks{%
\Psi\pars{{1 \over 2} + {\beta\,\ic \over 2}} -
\Psi\pars{{1 \over 2} - {\beta\,\ic \over 2}}}
\label{2}\tag{2}
\\[5mm] & =
-\,{\ic \over 2a}\braces{%
\pi\cot\pars{\pi\bracks{%
{1 \over 2} - {\beta\,\ic \over 2}}}} =
-\,{\pi\ic \over 2a}\tan\pars{\beta\,\ic \over 2}
\label{3}\tag{3}
\\[5mm] & =
\bbx{{\pi \over 2a}\tanh\pars{b \over 2\verts{a}}} \\ &
\end{align}

*

*$\ds{\Psi}$: Digamma Function.

*(\ref{2}): See $\ds{\color{black}{\bf 6.3.22}}$ in A & S Table.

*(\ref{3}): Euler Reflection Formula. See $\ds{\color{black}{\bf 6.3.7}}$ in A & S Table.

