A definite integral with hyperbolic cosines I want to show that $$ \int_{0}^{\infty} \frac{\cosh (ax) \cosh (bx)}{\cosh (\pi x)} \ dx = \frac{\cos ( \frac{a}{2} ) \cos ( \frac{b}{2})} {\cos (a) + \cos (b)} \ , \  |a|+|b| < \pi.$$
I thought one approach would be to integrate the appropriate function around a rectangle with vertices at $z=R$, $z=R+i$, $z=-R+i$, and $z=-R$.
I tried $\displaystyle f(z) = \frac{e^{(a+b)z}}{\cosh (\pi z)}, f(z) = \frac{e^{az} \cosh (bz)}{\cosh (\pi z)}$, and $\displaystyle f(z) = \frac{\cosh (az) \cosh (bz)}{\cosh (\pi z)}$.  
None of these three choices for $f(z)$ worked.  
EDIT:
As AD. stated in the comments, the integral can be rewritten as 
$$ \frac{1}{2} \int_{0}^{\infty} \frac{\cosh \big((a+b)x\big) + \cosh \big((a-b) x \big)}{\cosh (\pi x)} \ dx.  $$
By integrating $ \displaystyle f(z) = \frac{e^{\alpha z}}{\cosh (\pi z)}$ around the rectangle described above, one can show that $$\int_{0}^{\infty} \frac{\cosh (\alpha x)}{\cosh (\pi x)} \ dx = \frac{1}{2} \sec \left(\frac{\alpha}{2} \right) \ , \ |\alpha| < \pi. $$
Therefore, 
$$ \begin{align} &\int_{0}^{\infty} \frac{\cosh (ax) \cosh (bx)}{\cosh (\pi x)} \ dx \\ &= \frac{1}{4} \left[\sec \left(\frac{a+b}{2} \right) + \sec \left( \frac{a-b}{2}\right) \right] \\  &= \frac{1}{4} \left(\frac{1}{\cos (\frac{a}{2}) \cos (\frac{b}{2}) - \sin (\frac{a}{2}) \sin (\frac{b}{2})} + \frac{1}{\cos (\frac{a}{2}) \cos (\frac{b}{2}) + \sin (\frac{a}{2}) \sin (\frac{b}{2})}\right) \\ &= \frac{1}{2} \frac{\cos (\frac{a}{2}) \cos(\frac{b}{2})}{\cos^{2}(\frac{a}{2})\cos^{2} (\frac{b}{2}) - \sin^{2} (\frac{a}{2}) \sin^{2} (\frac{b}{2})} \\ &=  \frac{2 \cos (\frac{a}{2}) \cos(\frac{b}{2})}{\big(1+\cos(a)\big) \big(1+\cos(b) \big) - \big(1-\cos(a)\big) \big(1-\cos(b)\big)} \\ &= \frac{\cos (\frac{a}{2}) \cos (\frac{b}{2})}{\cos(a) + \cos (b)} . \end{align}$$
 A: I have a way of showing this without contour integration in the complex plane.  There is a bit of a trick involved and, frankly, Mathematica misleads.  It should be noted that the condition $|a|+|b| < \pi$ is needed for the integral to converge.  Basically, rewrite the $\cosh$'s as exponentials:
$$\begin{align} \int_{0}^{\infty} dx \: \frac{\cosh (ax) \cosh (bx)}{\cosh (\pi x)} &= 2 \int_{0}^{\infty} dx \: \frac{\cosh (ax) \cosh (bx)}{1+e^{-2 \pi x}} e^{-\pi x} \\ &= \frac{1}{2} \sum_{k=0}^{\infty} (-1)^k \int_{0}^{\infty} dx \: (e^{a x}+e^{-a x}) (e^{b x}+e^{-b x}) e^{-(2 k+1) \pi x} \\  \end{align}  $$
Evaluating the integrals, we get
$$= \frac{1}{2} \sum_{k=0}^{\infty} (-1)^k \left [ \frac{1}{(2 k+1)\pi -(a+b)} + \frac{1}{(2 k+1)\pi +(a+b)}\right ] $$
$$ + \frac{1}{2} \sum_{k=0}^{\infty} (-1)^k \left [ \frac{1}{(2 k+1)\pi -(a-b)} + \frac{1}{(2 k+1)\pi +(a-b)} \right ]  $$
Here I note that $a+b$ and $a-b$ should not be some multiple of $\pi$, so that the above sums behave properly.
To get the sums into a somewhat familiar form, I rearrange them a bit to get
$$= \frac{1}{4 \pi} \sum_{k=0}^{\infty} (-1)^k \left [ \frac{1}{k +\left (\frac{1}{2} - \frac{a+b}{2 \pi} \right )} + \frac{1}{k +\left (\frac{1}{2} + \frac{a+b}{2 \pi}\right )}\right ] $$
$$ + \frac{1}{4 \pi} \sum_{k=0}^{\infty} (-1)^k \left [ \frac{1}{k +\left (\frac{1}{2} - \frac{a-b}{2 \pi} \right )} + \frac{1}{k +\left (\frac{1}{2} + \frac{a-b}{2 \pi}\right )}\right ]  $$
Now, here is the interesting part (at least to me).  Let
$$f(z) = \sum_{k=0}^{\infty} \frac{(-1)^k}{k+z} $$
This looks like it should be a trig function of some sort.  It is not; rather, it is something called a Hurwitz-Lerch transcendent, which does not look like it will be much help.  That said, it almost looks like a trig function, so I instead considered the following:
$$\begin{align} f(z) + f(1-z) &= \sum_{k=0}^{\infty} \frac{(-1)^k}{k+z} + \sum_{k=0}^{\infty} \frac{(-1)^k}{k+1-z}\\ &= \sum_{k=0}^{\infty} \frac{(-1)^k}{z+k} + \sum_{k=0}^{\infty} \frac{(-1)^{k+1}}{z-(k+1)}\\ &= \sum_{k=-\infty}^{\infty}  \frac{(-1)^k}{z+k} \\ &= \frac{\pi}{\sin{\pi z}}\\ \end{align}$$
This is very helpful, because we have precisely this functional form above, e.g.,
$$\frac{1}{2} - \frac{a+b}{2 \pi} = 1 - \left ( \frac{1}{2} + \frac{a+b}{2 \pi} \right ) $$
$$\frac{1}{2} - \frac{a-b}{2 \pi} = 1 - \left ( \frac{1}{2} + \frac{a-b}{2 \pi} \right ) $$
So we get for the integral:
$$\begin{align} \int_{0}^{\infty} dx \: \frac{\cosh (ax) \cosh (bx)}{\cosh (\pi x)} &= \frac{1}{4} \left [ \frac{1}{\sin{\left ( \frac{\pi}{2} - \frac{a+b}{2} \right )}} + \frac{1}{\sin{\left ( \frac{\pi}{2} - \frac{a-b}{2} \right )}} \right ] \\ &= \frac{1}{4} \left [ \frac{1}{\cos{\left ( \frac{a+b}{2} \right )}} + \frac{1}{\cos{\left ( \frac{a-b}{2} \right )}} \right ] \\ &= \frac{\cos{\frac{a}{2}} \cos{\frac{b}{2}}}{\cos{a} + \cos{b}} \end{align}$$
QED
A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,{\rm Li}_{#1}}
 \newcommand{\norm}[1]{\left\vert\left\vert\, #1\,\right\vert\right\vert}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$

$\ds{\int_{0}^{\infty}{\cosh\pars{ax}\cosh\pars{bx}\over
     \cosh\pars{\pi x}}\,\dd x
     ={\cos\pars{a/2}\cos\pars{b/2} \over \cos\pars{a} + \cos\pars{b}}:\ {\large ?}
     \,,\quad \verts{a} + \verts{b} < \pi}$

\begin{align}&\color{#66f}{\large%
\int_{0}^{\infty}{\cosh\pars{ax}\cosh\pars{bx}\over\cosh\pars{\pi x}}\,\dd x}\ =\
\overbrace{\half\int_{-\infty}^{\infty}
{\cosh\pars{ax}\cosh\pars{bx}\over\cosh\pars{\pi x}}\,\dd x}
^{\dsc{\expo{\pi x}\equiv t\ \imp\ x={1 \over \pi}\,\ln\pars{t}}}
\\[5mm]&=\half\int_{0}^{\infty}{\bracks{\pars{t^{\alpha} + t^{-\alpha}}/2}
\bracks{\pars{t^{\beta} + t^{-\beta}}/2}\over
\bracks{\pars{t^{2} + 1}/\pars{2t}}}\,{\dd t \over \pi t}
\end{align}

where $\ds{\alpha \equiv {\verts{a} \over \pi}}$ and
  $\ds{\beta \equiv {\verts{b} \over \pi}}$ 

Then,
\begin{align}
&\color{#66f}{\large%
\int_{0}^{\infty}\!\!\!{\cosh\pars{ax}\cosh\pars{bx}\over\cosh\pars{\pi x}}\,\dd x}
\\[5mm]&={1 \over 4\pi}\int_{0}^{\infty}\!\!\!
{t^{\alpha + \beta} \over t^{2} + 1}\,\dd t
+{1 \over 4\pi}\int_{0}^{\infty}\!\!\!{t^{\alpha - \beta} \over t^{2} + 1}\,\dd t
+{1 \over 4\pi}\int_{0}^{\infty}\!\!{t^{-\alpha + \beta} \over t^{2} + 1}\,\dd t
+{1 \over 4\pi}\int_{0}^{\infty}\!\!{t^{-\alpha - \beta} \over t^{2} + 1}\,\dd t
\,\,\,\,\,\pars{1}
\end{align}

The problem is reduced to the evaluation of
  $\ds{{1 \over 4\pi}\int_{0}^{\infty}{t^{\mu} \over t^{2} + 1}\,\dd t}$,
  $\ds{\pars{~\mbox{with}\ \verts{\Re\pars{\mu}} < 1~}}$, in the complex plane. For this purpose we use a 'key-hole contour' which takes care of the $\ds{z^{\mu}\mbox{-branch cut}}$:
  $$
z^{\mu}=\verts{z}^{\mu}\exp\pars{\ic\mu\,{\rm Arg}\pars{z}}\,,\qquad z\not= 0\,,\qquad \verts{\,{\rm Arg}\pars{z}} < \pi
$$

\begin{align}&{1 \over 4\pi}\,2\pi\ic\pars{%
{\expo{\pi\mu\ic/2} \over 2\ic} + {\expo{-\pi\mu\ic/2} \over -2\ic}}
=\dsc{\half\,\ic\sin\pars{\pi\mu \over 2}}
\\[5mm]&={1 \over 4\pi}
\int_{-\infty}^{0}{\pars{-t}^{\mu}\expo{\pi\mu\ic} \over t^{2} + 1}\,\dd t
+{1 \over 4\pi}
\int_{0}^{-\infty}{\pars{-t}^{\mu}\expo{-\pi\mu\ic} \over t^{2} + 1}\,\dd t
\\[5mm]&=\expo{\pi\mu\ic}\,{1 \over 4\pi}
\int_{0}^{\infty}{t^{\mu} \over t^{2} + 1}\,\dd t
-\expo{-\pi\mu\ic}\,{1 \over 4\pi}
\int_{0}^{\infty}{t^{\mu} \over t^{2} + 1}\,\dd t
\\[5mm]&=\dsc{2\ic\sin\pars{\pi\mu}\pars{%
{1 \over 4\pi}\int_{0}^{\infty}{t^{\mu} \over t^{2} + 1}\,\dd t}}\
\imp\
\begin{array}{|c|}\hline\\
\quad
{1 \over 4\pi}\int_{0}^{\infty}{t^{\mu} \over t^{2} + 1}\,\dd t
={1 \over 8}\,\sec\pars{\pi\mu \over 2}\quad
\\ \\ \hline
\end{array}
\end{align}

Then, the expression $\pars{1}$ is reduced to:

\begin{align}
&\color{#66f}{\large%
\int_{0}^{\infty}{\cosh\pars{ax}\cosh\pars{bx}\over\cosh\pars{\pi x}}\,\dd x}
={1 \over 4}\,\sec\pars{\verts{a} + \verts{b} \over 2}
+{1 \over 4}\,\sec\pars{\verts{a} - \verts{b} \over 2}
\\[5mm]&={1 \over 4}\,{\cos\pars{\bracks{\verts{a} - \verts{b}}/2}
+\cos\pars{\bracks{\verts{a} + \verts{b}}/2}\over
\cos\pars{\bracks{\verts{a} - \verts{b}}/2}
\cos\pars{\bracks{\verts{a} + \verts{b}}/2}}
\\[5mm]&={1 \over 4}\,{2\cos\pars{a}\cos\pars{b}\over
\cos^{2}\pars{a/2}\cos^{2}\pars{b/2} - \sin^{2}\pars{a/2}\sin^{2}\pars{b/2}}
\\[5mm]&=\half\,{\cos\pars{a}\cos\pars{b}\over
\cos^{2}\pars{a/2}\cos^{2}\pars{b/2}-
\bracks{1 - \cos^{2}\pars{a/2}}\bracks{1 - \cos^{2}\pars{b/2}}}
\\[5mm]&=\half\,{\cos\pars{a}\cos\pars{b}\over
-1 + \cos^{2}\pars{a/2} + \cos^{2}\pars{b/2}}
=\half\,{\cos\pars{a}\cos\pars{b}\over
-1 + \bracks{1 + \cos\pars{a}}/2 + \bracks{1 + \cos\pars{b}}/2}
\end{align}

Finally,

$$
\color{#66f}{\large%
\int_{0}^{\infty}{\cosh\pars{ax}\cosh\pars{bx}\over\cosh\pars{\pi x}}\,\dd x}
=\color{#66f}{\large%
{\cos\pars{a/2}\cos\pars{b/2} \over \cos\pars{a} + \cos\pars{b}}}\,,\qquad
\verts{a} + \verts{b} < \pi
$$
