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.