Find the value of $\int ^{\infty}_{-\infty} \frac{\cos x}{e^x+e^{-x}} dx$ Show that  $$\int ^{\infty}_{-\infty} \frac{\cos x}{e^x+e^{-x}}dx=\frac{\pi}{e^\frac{\pi}{2}+e^{-\frac{\pi}{2}}}.$$
How do we solve this? Since given function is even, it follows that
$$ \int ^{\infty}_{-\infty} \frac{\cos x}{e^x+e^{-x}}dx= 2\int ^{\infty}_{0} \frac{\cos x}{e^x+e^{-x}}dx,$$
but I can't go for further.

$$
\begin{aligned}
\int_{-\infty}^{\infty} \frac{\cos x}{e^x+e^{-x}} d x 
= & 2 \operatorname{Re} \int_0^{\infty} \frac{e^{-x} \cdot e^{i x}}{1+e^{-2 x}} d x \\
= & 2 \operatorname{Re} \sum_{n=0}^{\infty} \int_0^{\infty} e^{(i-1-2 n) x} d x \\
= & 2  \operatorname{Re} \sum_{n=0}^{\infty} \left(-1\right)^n\left[\frac{e^{(i-1-2 n) x}}{i-1-2 n}\right]_0^{\infty} \\
= & 2 \operatorname{Re} \sum_{n=0}^{\infty} \frac{(-1)^n}{2 n+1-i} \\
= & 2 \operatorname{Re}\sum_{n=0}^{\infty} \frac{(-1)^n(2 n+1+i)}{(2 n+1)^2+1} \\
= & 2 \sum_{n=0}^{\infty} \frac{(-1)^n(2 n+1)}{(2 n+1)^2+1} \\
= & \frac{\pi}{2} \operatorname{sech}\left(\frac{\pi}{2}\right)
\end{aligned}
$$
