Solve $\int \limits_{0}^{\infty} \frac{\cos(x)}{\cosh(x)} dx$ without complex integration. Solve $$\int \limits_{0}^{\infty} \frac{\cos(x)}{\cosh(x)} dx$$ without complex integration.
This integral can be very easily solved with contour integration, but how can you solve it without taking a tour in the complex plane?

The integral is equal to
$$\begin{align}2 \int_0^{\infty} dx\, e^{-x} \frac{\cos{x}}{1+e^{-2 x}} &= 2\sum_{k=0}^{\infty} (-1)^k \int_0^{\infty} dx \, e^{-(2 k+1) x} \cos{x} \\ &= 2\operatorname{Re} \sum_{k=0}^{\infty}\frac{(-1)^k}{2 k+1-i}\\ &= 2\sum_{k=0}^{\infty} (-1)^k \frac{2 k+1}{(2 k+1)^2+1}\\ &= \sum_{k=-\infty}^{\infty} (-1)^k \frac{2 k+1}{(2 k+1)^2+1}\\ &=-\pi \sum_{\pm} \operatorname*{Res}_{z=\frac{-1\pm i}{2}}\frac{(2 z+1) \csc{\pi z}}{(2 z+1)^2+1} \\ &= \frac{\pi}{2} \left [ \frac1{\sin{\left ( \frac{\pi}{2} - \frac{\pi i}{2}\right )}} + \frac1{\sin{\left ( \frac{\pi}{2} + \frac{\pi i}{2}\right )}}\right ]\\ &= \frac{\pi}{2 \cosh{(\pi/2)}}\end{align}$$
