I want to compute the integral $$ \int_0^\infty \frac{dx}{(x^2+{\pi}^2)\cosh(x)} $$
I tried to use "rectangle" contour $(0 \to R \to R+i\pi \to i\pi+\varepsilon \to i\pi - i\varepsilon \to 0)$, but this is useless because the integral on the upper side is not expressed (it didn’t work out for me) through the original integral.
Also, representing a fraction as a sum of simple fractions (probably) does not facilitate the task.
And representing the integral as an integral on $\mathbb{R}$ does nothing, since the imaginary axis has a countable number of poles...
Please tell me what kind of substitution in the integral I need to do or which one to choose the contour???
In fact, I found that decomposition into simple fractions solves the problem! $$ I=\int_0^\infty \frac{dx}{(x^2+{\pi}^2)\cosh(x)}=\int_{-\infty}^\infty dx\frac{e^{x}}{(x^2+{\pi}^2)(e^{2x}+1)}= \\ \frac{1}{2\pi i}\int_{-\infty}^\infty dx\frac{e^{x}}{(x-i\pi)(e^{2x}+1)}-\frac{1}{2\pi i}\int_{-\infty}^\infty dx\frac{e^{x}}{(x+i\pi)(e^{2x}+1)} $$ After the obvious substitution it's equal to $$ I=-\frac{1}{2\pi i}\int_{-\infty-\pi i}^{\infty-\pi i} dx\frac{e^{x}}{x(e^{2x}+1)}+\frac{1}{2\pi i}\int_{-\infty+\pi i}^{\infty+\pi i} dx\frac{e^{x}}{x(e^{2x}+1)} $$ Now if we take the contour: $-R+\pi i \to R+\pi i \to R - \pi i \to -R - \pi i$, then it's clear, that $$I = -\sum\limits_{k} Res[f(z),z_k]$$ Where $f(z)=\frac{e^{z}dz}{z(e^{2z}+1)}$ and $z_k \in[-\frac{\pi i}{2}, \ 0,\ \frac{\pi i}{2}]$.
Thus the answer follows: $I=\frac{2}{\pi}-\frac{1}{2}$.