Result of $\int_{-\infty}^{\infty}\frac{\cos(ax)}{e^x+e^{-x}}$ I'm trying to validate if result of this integral is equal to:
$$
\frac{\pi*ch(a\frac{\pi}{2})}{ch(\pi))+1})
$$
I'm trying to resolve it using the reside in $\frac{\pi}{2}$ but couldn't find a resolution to compare.
Any help is most appreciated.
 A: Notice that $$\int_{-\infty}^{\infty} \frac{e^{iax}}{e^x + e^{-x}}= \int_{-\infty}^{\infty} \frac{\cos(ax)}{e^x + e^{-x}} dx + i\int_{-\infty}^{\infty} \frac{\sin(ax)}{e^x + e^{-x}}dx$$
Therefore, let's compute the left-hand side and take the real part of the result. Let's take the rectangular contour whose base lies on the $x$-axis and has a height that goes up to $y=i\pi$ in the imaginary axis (that way we capture our pole of $i\pi/2$ but none of the other poles. We'll call this contour $\Gamma$.
Now, we have 4 separate line integrals for each side of the rectangle, but using the ML-Inequality you can show that the line integrals over the two vertical sides of the rectangle go to 0.
We're left with $$\int_{\Gamma} \frac{e^{iaz}}{e^z + e^{-z}} dz= \lim_{R\to\infty} \Bigg(\int_{-R}^{R} \frac{e^{iax}}{e^x + e^{-x}} dx+ \int_{R+i\pi}^{-R+i\pi} \frac{e^{iaz}}{e^x + e^{-z}}dz\Bigg)$$
For the right-most integral, we can use the parametrization $\gamma(t)=i\pi + t$, where $-R\leq t \leq R$. After some algebra, we get that:
$$\int_{\Gamma} \frac{e^{iaz}}{e^z + e^{-z}} dz= (1+e^{-a\pi})\int_{-\infty}^{\infty}\frac{e^{iax}}{e^x + e^{-x}} dx$$
We compute the left-hand side using the residue theorem to get:
$$\pi e^{-a\pi/2} =(1+e^{-a\pi})\int_{-\infty}^{\infty}\frac{e^{iax}}{e^x + e^{-x}} dx$$
Which means that  $$\int_{-\infty}^{\infty}\frac{e^{iax}}{e^x + e^{-x}} dx = \frac{\pi e^{-a\pi/2}}{1+e^{-a\pi}} $$
We can take the real part of both sides, but the right-hand side is already purely real-valued, so we conclude that
$$\int_{-\infty}^{\infty} \frac{\cos(ax)}{e^x + e^{-x}} dx = \frac{e^{-a\pi/2}}{1+e^{-a\pi}}$$
