Here is another solution: Let
$$\hat{f}(\xi) = \int_{\Bbb{R}} f(x)e^{-2\pi i \xi x} \, dx$$
denote the Fourier transform of $f$. Then it is well-known that
$$ (\mathrm{sech} \, \pi x)^{\wedge} = \mathrm{sech} \, \pi \xi \quad \text{and} \quad \left( \frac{1}{a^2 + \pi^2 x^2} \right)^{\wedge} = \frac{1}{a} e^{-2a |\xi|}. $$
Also, if both $f$ and $g$ are in $L^2$, then
$$ \int_{\Bbb{R}} \hat{f} g = \int_{\Bbb{R}} f \hat{g}. $$
In particular, plugging $f(x) = \mathrm{sech} \, \pi x$ we have
$$ \int_{\Bbb{R}} \frac{g(x)}{\cosh \pi x} \, dx = \int_{\Bbb{R}} \frac{\hat{g}(x)}{\cosh \pi x} \, dx. $$
This shows that
\begin{align*}
\int_{0}^{\infty} \frac{dx}{(x^2 + 1) \cosh a x}
&= \frac{\pi a}{2} \int_{-\infty}^{\infty} \frac{dx}{(a^2 + \pi^2 x^2) \cosh \pi x} \\
&= \frac{\pi}{2} \int_{-\infty}^{\infty} \frac{e^{-2a|x|}}{\cosh \pi x} \, dx
= \pi \int_{0}^{\infty} \frac{e^{-2a x}}{\cosh \pi x} \, dx \\
&= 2\pi \int_{0}^{\infty} \frac{e^{-(2a+\pi) x} (1 - e^{-2\pi x})}{1 - e^{-4\pi x}} \, dx \\
&= \frac{1}{2} \int_{0}^{1} \frac{t^{\frac{a}{2\pi}+\frac{1}{4}} (1 - t^{\frac{1}{2}})}{1 - t} \, \frac{dt}{t} \qquad (t = e^{-4\pi x}) \\
&= \frac{1}{2} \left[ \psi_{0}\left( \frac{a}{2\pi}+\frac{3}{4} \right) - \psi_{0}\left( \frac{a}{2\pi}+\frac{1}{4} \right) \right],
\end{align*}
where we exploited the identity
$$ \psi_{0}(s) = -\gamma + \int_{0}^{1}\frac{t - t^{s}}{1 - t} \, \frac{dt}{t}. $$
Integrals of the form
$$\int_{-\infty}^\infty \frac{p(x)}{\cosh x}\,dx,$$
where $p$ is a polynomial can be evaluated by shifting the contour of integration to a line $\operatorname{Im} z \equiv c$. We first check that the integrals over the vertical segments connecting the two lines tend to $0$ as the real part tends to $\pm\infty$:
$$\lvert \cosh (x+iy)\rvert^2 = \lvert \cosh x\cos y + i \sinh x\sin y\rvert^2 = \sinh^2 x + \cos^2 y,$$
so the integrand decays exponentially and
$$\left\lvert \int_{R}^{R + ic} \frac{p(z)}{\cosh z}\,dz\right\rvert
\leqslant \frac{K\,c}{\sinh R}\left(R^2+c^2\right)^{\deg p/2} \xrightarrow{R\to \pm\infty} 0.$$
Since $\cosh \left(z+\pi i\right) = -\cosh z$, and the only singularity of the integrand between $\mathbb{R}$ and $\mathbb{R}+\pi i$ is a simple pole at $\frac{\pi i}{2}$ (unless $p$ has a zero there, but then we can regard it as a simple pole with residue $0$) with the residue
$$\operatorname{Res}\left(\frac{p(z)}{\cosh z};\, \frac{\pi i}{2}\right) = \frac{p\left(\frac{\pi i}{2}\right)}{\cosh' \frac{\pi i}{2}} = \frac{p\left(\frac{\pi i}{2}\right)}{\sinh \frac{\pi i}{2}} = \frac{p\left(\frac{\pi i}{2}\right)}{i},$$
the residue theorem yields
$$\begin{align}
\int_{-\infty}^\infty \frac{p(x)}{\cosh x}\,dx
&= 2\pi\, p\left(\frac{\pi i}{2}\right) + \int_{\pi i-\infty}^{\pi i+\infty} \frac{p(z)}{\cosh z}\,dz\\
&= 2\pi\, p\left(\frac{\pi i}{2}\right) - \int_{-\infty}^\infty \frac{p(x+\pi i)}{\cosh x}\,dx\\
&= 2\pi\, p\left(\frac{\pi i}{2}\right) - \sum_{k=0}^{\deg p} \frac{(\pi i)^k}{k!}\int_{-\infty}^\infty \frac{p^{(k)}(x)}{\cosh x}\,dx.\tag{1}
\end{align}$$
Since $\cosh$ is even, only even powers of $x$ contribute to the integrals, hence we can from the beginning assume that $p$ is an even polynomial, and need only consider the derivatives of even order.
For a constant polynomial, $(1)$ yields
$$\int_{-\infty}^\infty \frac{dx}{\cosh x} = 2\pi - \int_{-\infty}^\infty \frac{dx}{\cosh x}\Rightarrow \int_{-\infty}^\infty \frac{dx}{\cosh x} = \pi.$$
For $p(z) = z^2$, we obtain
$$\begin{align}
\int_{-\infty}^\infty \frac{x^2}{\cosh x}\,dx &= 2\pi \left(\frac{\pi i}{2}\right)^2 - \int_{-\infty}^\infty \frac{x^2}{\cosh x}\,dx - (\pi i)^2\int_{-\infty}^\infty \frac{dx}{\cosh x}\\
&= - \frac{\pi^3}{2} - \int_{-\infty}^\infty \frac{x^2}{\cosh x}\,dx + \pi^3,
\end{align}$$
which becomes
$$\int_{-\infty}^\infty \frac{x^2}{\cosh x}\,dx = \frac{\pi^3}{4}.$$
Best Answer
Simple computation yields $$ \cos(z)+\cosh(z)=2\cos(\alpha z)\cosh(\alpha z)\tag{1} $$ where $\alpha=\frac{1+i}{2}$. The zeros of $\cos(z)+\cosh(z)$ are at $$ z_k^\pm=\left(k\pi+\frac\pi2\right)(1\pm i)\tag{2} $$ and $$ \operatorname*{Res}_{\ \ z=z_k^\pm}\frac1{\cos(z)+\cosh(z)} =\frac{1\pm i}{2}(-1)^{k+1}\mathrm{sech}\left(k\pi+\frac\pi2\right)\tag{3} $$ The residues in the upper half-plane are $z_k^+$ where $k\ge0$ and $z_k^-$ where $k\lt0$. Pairing the residues at $z_k^+$ and $z_{-k-1}^-$ yields the sum of the residues in the upper half-plane to be $$ -i\sum_{k=0}^\infty(-1)^k\mathrm{sech}\left(k\pi+\frac\pi2\right)\tag{4} $$ Therefore, we can use contour integration to get $$ \begin{align} \int_{-\infty}^\infty\frac{\mathrm{d}x}{\cos(x)+\cosh(x)} &=2\pi\sum_{k=0}^\infty(-1)^k\mathrm{sech}\left(k\pi+\frac\pi2\right)\\[6pt] &\doteq2.3958786339145620925\tag{5} \end{align} $$