<s>[INST] How to evaluate $\int_{-\infty}^\infty \frac{\cos x}{\cosh x}\,\mathrm dx$ by hand How can I evaluate$$\int_{-\infty}^\infty \frac{\cos x}{\cosh x}\,\mathrm dx\text{ and }\int_0^\infty\frac{\sin x}{e^x-1}\,\mathrm dx.$$
Thanks in advance.
 [/INST] For the second one,
$$ \begin{align*}
\int_{0}^{\infty} \frac{\sin x}{e^x - 1} \; dx
&= \int_{0}^{\infty} \frac{\sin x \, e^{-x}}{1 - e^{-x}} \; dx \\
&= \int_{0}^{\infty} \left( \sum_{n=1}^{\infty} \sin x \, e^{-nx} \right) \; dx \\
&\stackrel{\ast}{=} \sum_{n=1}^{\infty} \int_{0}^{\infty} \sin x \, e^{-nx} \; dx \\
&= \sum_{n=1}^{\infty} \frac{1}{1+n^2},
\end{align*}$$
where the starred identity is justified by the following formula
$$ \begin{align*}
\int_{0}^{\infty} \frac{\sin x}{e^x - 1} \; dx
&= \int_{0}^{\infty} \left( \frac{1 - e^{-Nx}}{1 - e^{-x}} e^{-x} + \frac{e^{-Nx}}{e^x - 1} \right) \sin x \; dx \\
&= \sum_{n=1}^{N} \int_{0}^{\infty} \sin x \, e^{-nx} \; dx + \int_{0}^{\infty} \frac{\sin x \, e^{-Nx}}{e^x - 1} \; dx,
\end{align*}$$
together with the dominated convergence theorem. Now the resulting infinite summation can be evaluated in numerous ways. For example, exploiting identities involving the digamma function,
$$ \sum_{n=1}^{\infty} \frac{1}{1+n^2} = \frac{1}{2i} \sum_{n=1}^{\infty} \left( \frac{1}{n-i} - \frac{1}{n+i} \right) = \frac{\psi_0(1+i) - \psi_0(1-i)}{2i} = -\frac{1}{2} + \frac{\pi}{2} \coth \pi. $$
Similar techniques apply to the first integral.
</s>