Evaluating $\int_{-\infty}^{\infty} e^{i \lambda x} \frac{\sinh ax}{\sinh \pi x} dx $ using complex analysis I'm studying Complex Analysis presently, and I'm stuck in this problem.
$$ \displaystyle \int_{-\infty}^{\infty} e^{i \lambda x} \frac{\sinh ax}{\sinh \pi x} dx $$
Where $ a \in (- \pi , \pi) $
I tried it using the rectangular contour and by assuming that $  \displaystyle f(z) = e^{i \lambda z} \frac{e^{az}}{\sinh \pi z} $.
But I'm unable to get the correct answer. How do I tackle this problem?
 A: The integral equals
$$ \int_{-\infty}^{+\infty}\cos(\lambda x)\frac{\sinh(ax)}{\sinh(\pi x)}\,dx =2\int_{0}^{+\infty}\cos(\lambda x)\frac{e^{ax}-e^{-ax}}{e^{\pi x}-e^{-\pi x}}\,dx = 2\int_{0}^{+\infty}\cos(\lambda x)\frac{e^{(a-\pi)x}-e^{-(a+\pi)x}}{1-e^{-2\pi x}}\,dx$$
or
$$ 2\sum_{n\geq 0}\int_{0}^{+\infty}\cos(\lambda x)\left( e^{(a-(2n+1)\pi)x}-e^{-(a+(2n+1)\pi)x}\right)\,dx $$
or (by the Laplace transform of the cosine function)
$$ 2 \sum_{n\geq 0}\left(\frac{(2n+1)\pi-a}{\lambda^2+((2n+1)\pi-a)^2}-\frac{(2n+1)\pi+a}{\lambda^2+((2n+1)\pi+a)^2}\right)=\text{Re }\tan\left(\frac{a+i\lambda}{2}\right) $$
or
$$ \frac{\tan(a/2)-\tan(a/2)\tanh^2(\lambda/2)}{1+\tan^2(a/2)\tanh^2(\lambda/2)}.$$
A: For the evaluation via complex integration we have to create a closed contour in the complex plane. We can use a rectangular contour with added two small arches around $z=0$ and $z=i$ (clockwise).

Denoting $\displaystyle I(a)=\int_{-\infty}^\infty e^{i \lambda x} \frac{e^{ax}}{\sinh \pi x}dx\,\,$ (the integral is evaluated in the principal value sense),
$\displaystyle \qquad\oint e^{i \lambda z} \frac{e^{az}}{\sinh \pi z}dz=I(a)+I_{1r}+I_1+I(a)e^{-\lambda+ia}+I_{2r}+I_2=0$
because there are no poles inside the chosen contour. The estimation of the side integrals $I_{1,2}$ is straightforward and gives zero at $R\to\infty$.
Therefore,
$$I(a)\big(1+e^{-\lambda+ia}\big)=-I_{1r}-I_{2r}=\pi i\big(\operatorname{Res}_{z=0}e^{i \lambda z} \frac{e^{az}}{\sinh \pi z}+\operatorname{Res}_{z=i}e^{i \lambda z} \frac{e^{az}}{\sinh \pi z}\big)$$
$$I(a)=i\frac{1-e^{-\lambda+ia}}{1+e^{-\lambda+ia}}=i\frac{e^{\lambda/2-ia/2}-e^{-\lambda/2+ia/2}}{e^{\lambda/2-ia/2}+e^{-\lambda/2+ia/2}}=\frac{\sin (a/2+i\lambda/2)}{\cos (a/2+i\lambda/2)}$$
The initial integral
$$J(a)=\frac{1}{2}\big(I(a)-I(-a)\big)=\frac{1}{2}\bigg(\frac{\sin \frac{a+i\lambda}{2}}{\cos \frac{a+i\lambda}{2}}+\frac{\sin \frac{a-i\lambda}{2}}{\cos \frac{a-i\lambda}{2}}\bigg)=\Re\tan\frac{a+i\lambda}{2}$$
