Show that $\int_{0}^{\infty} \frac{\cosh(ax)}{\cosh(\pi x)} dx=\frac{1}{2}\sec(\frac{a}{2})$ using Residue Calculus 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.
 A: 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!
A: Assuming $a\in(0,\pi)$, we have:
$$\begin{eqnarray*} \frac{\cosh(ax)}{\cosh(\pi x)} = \frac{e^{ax}+e^{-ax}}{e^{\pi x}+e^{-\pi x}}=(e^{ax}+e^{-ax})\sum_{n\geq 0}(-1)^n e^{-(2n+1)\pi x}\end{eqnarray*}$$
hence:
$$\begin{eqnarray*} \int_{0}^{+\infty}\frac{\cosh(ax)}{\cosh(\pi x)} = \sum_{n\geq 0}(-1)^n\left(\frac{1}{(2n+1)\pi-a}+\frac{1}{(2n+1)\pi+a}\right)=g(a)\end{eqnarray*} $$
where the RHS is a meromorphic function with simple poles at every element of $\pi+2\pi\mathbb{Z}$, having residues:
$$ \text{Res}\left(g(a),a=(2k+1)\pi\right) = (-1)^{k+1}.$$
The same happens for the function $f(a)=\frac{1}{2}\sec\left(\frac{a}{2}\right)$. In a neighbourhood $U$ of the imaginary axis both $f$ and $g$ are bounded and converging to $0$ as $|z|\to+\infty$, hence $f\equiv g$.
