$$\int_{-\infty}^{\infty} \frac{\cos(mx) dx}{e^{-x}+e^x} = \frac{\pi}{e^{m\pi /2}+e^{-m\pi /2}}$$
I need to evaluate the above integral specifically using a rectangluar contour and at some point applying the residue theorem. I should be ok with the residue part, but I'm confused at to how to get this into the example form shown in the book:
$$I =\int_{-\infty}^{\infty} \frac{e^{ax}dx}{1+e^x}=\frac{\pi}{\sin(a\pi)} $$
I tried using the identity $\cos (mx) = \frac{e^{ix}+e^{-ix}}{2}$ but I end up with $\frac{1}{2} \int_{-\infty}^{\infty}\frac{e^{ix}(e^{imx}+e^{-imx})dx}{1+e^{2ix}}$, which almost resembles the example but not quite...
$$\begin{align*} \frac{\cos mx}{e^x + e^{-x}} = \frac{1}{2}\frac{e^{imx} + e^{-imx}}{e^x + e^{-x}}&= \frac{1}{2}\frac{e^{imx} + e^{-imx}}{e^x + e^{-x}} = \frac{1}{2}\frac{e^{(1 + im)x} + e^{(1 - im)x}}{e^{2x} + 1} \\ &= \frac{1}{2}\frac{e^{(1 + im)x} + e^{(1 - im)x}}{e^{2x} + 1} \end{align*}$$ Then use change of variable $y = 2x$.