Show that the following expression is true
$$\int_{0}^{\infty} \frac{\cosh(ax)}{\cosh(\pi x)} dx=\frac{1}{2}\sec(\frac{a}{2})$$
Edit: I forgot to mention that $|a|<\pi$
Specifically,
using Residue Calculus and a rectangular contour with corners at $\pm R$ and $\pm R+i$
However, I'm unsure how to approach this given the bound from $(0,\infty)$, where I usually see the bound $(- \infty, \infty )$. How does this change the problem, and how should I begin to approach it from here?
Edit: Given the tip that the integrand is an even function, I can use the following relation:
$$\int_{0}^{\infty} \frac{\cosh(ax)}{\cosh(\pi x)} dx= \frac{1}{2} \int_{- \infty}^{\infty} \frac{\cosh(ax)}{\cosh(\pi x)} dx$$
Next I proceed by the standard procedure
$$\oint_C f(z) \,dz=(\int_{C_{R}}^{}+\int_{C_{T}}^{}+\int_{C_{L}}^{}+\int_{C_{B}}^{})f(z)dz=2 \pi i \sum_{j}\text{Res}(f(z);z_j)$$
where $f(z)=\frac{\cosh(az)}{\cosh(\pi z)}$ and R, T, L, and B denote the right, top, left, and bottom sides of the rectangular contour. Furthermore, I can bound each $C_i$ integral and determine what happens as R approaches $\infty$ to ultimately simplify the above expression.
In fact, the side contour integrals do disappear as R approaches $\infty$, and the bottom integral becomes our integral of interest.
$$\oint_C f(z) \,dz=(\int_{C_{T}}^{}+\int_{C_{B}}^{})f(z)dz=2 \pi i \sum_{j}^{}\text{Res}(f(z);z_j)$$
However, I am left clueless as to how to deal with the top integral.
We assume that $|a|<\pi$. Note that we have
$$\int_0^\infty \frac{\cosh(ax)}{\cosh(\pi x)}\,dx=\frac12 \int_{-\infty}^\infty \frac{\cosh(ax)}{\cosh(\pi x)}\,dx$$
Now, we analyze the contour integral $I(a)$ given by
$$I(a)=\oint_C \frac{\cosh(az)}{\cosh(\pi z)}\,dz$$
where $C$ is the rectangular contour with corners at $\pm R$ and $\pm R+i$. Thus, we can write
$$\begin{align}
I(a)&=\int_{-R}^R \frac{\cosh(ax)}{\cosh(\pi x)}\,dx\\\\
&+\int_{0}^1\frac{\cosh(a(R+iy))}{\cosh(\pi (R+iy))}\,i\,dy\\\\
&+\int_{R}^{-R}\frac{\cosh(a(x+i))}{\cosh(\pi (x+i))}\,dx\\\\
&+\int_{1}^0\frac{\cosh(a(-R+iy))}{\cosh(\pi (-R+iy))}\,i\,dy \tag 1
\end{align}$$
As $R\to \infty$, the second and fourth integrals approach zero. Using the residue theorem, $I(a)$ is
$$\begin{align}
I(a)&=2\pi i \text{Res}\left( \frac{\cosh(az)}{\cosh(\pi z)}, z=i/2\right)\\\\
&=2\cos(a/2) \tag 2
\end{align}$$
Now, we have using $(1)$ and $(2)$
$$\begin{align}
\int_{-\infty}^\infty \frac{\cosh(ax)}{\cosh(\pi x)}\,dx&=2\cos(a/2)+ \int_{-\infty}^\infty\frac{\cosh(a(x+i))}{\cosh(\pi (x+i))}\,dx\\\\
&=2\cos(a/2)- \int_{-\infty}^\infty\frac{\cosh(ax)\cos(a)+i\sinh(ax)\sin(a)}{\cosh(\pi x)}\,dx \tag 3\\\\
&=2\cos(a/2)-\cos(a) \int_{-\infty}^\infty\frac{\cosh(ax)}{\cosh(\pi x)}\,dx \tag 4\\\\
&=\frac{2\cos(a/2)}{1+\cos(a)}\\\\
&=\frac{1}{\cos(a/2)}
\end{align}$$
where in going from $(3)$ to $(4)$ we exploited the fact that $\frac{\sinh(ax)}{\cosh(\pi x)}$ is an odd function, and the integral of an odd function over anti-symmetric limits is zero.
Therefore, the integral of interest is found to be
$$\bbox[5px,border:2px solid #C0A000]{\int_0^\infty \frac{\cosh(ax)}{\cosh(\pi x)}\,dx=\frac{1}{2\cos(a/2)}}$$
as was to be shown!