Let $a \in \mathbb{C}$ with $-1 <$ Re $a < 1$. By considering a rectangular contour with corners at $R, R + i\pi, -R+ i\pi, -R,$ show that
$$\int_{-\infty}^{\infty}\frac{e^{ax}}{\cosh{x}}dx = \pi\sec\left( \frac{\pi a}{2}\right)$$
and hence evaluate, for real $n$,
$$\int_{-\infty}^{\infty}\frac{\cos nx}{\cosh{x}}dx$$
I can do everything in the question except showing that the integrals along the two sides of the rectangle vanish as $R$ tends to infinity.
I have these two paths as $\gamma_1(t) = R +it$ for $t\in[0,\pi]$ and $\gamma_2(t) = -R + (\pi-t)i$ for $t\in[0,\pi]$. I'm pretty sure these are right, but I really can't see how the integral of $\frac{e^{az}}{\cosh{z}}$ goes to zero when you integrate along these.
I'd really appreciate whatever help you could offer.

Let's write everything in terms of exponentials; the integrand is $\frac{2\exp(ax)}{\exp(x)+\exp(-x)}$. For $x$ with large positive real part, the first term $e^x$ of the denominator is much larger than the second term $e^{-x}$, so the overall fraction is very close to $\frac{2\exp(ax)}{\exp(x)}=2e^{(a-1)x}$. Now we use that condition about $a$ - since its real part is less than $1$, $a-1$ has negative real part, and $e^{(a-1)x}$ goes to zero (exponentially fast, not that we really need that). Well, OK, we need more than just a large real part for $x$ there; we also need it to be close to the real axis in angular terms, so that multiplying by $a-1$ doesn't rotate it back to the right-hand half-plane. Fortunately, the vertical edge of the rectangle we're looking at is close to the real axis.
For the vertical edge at $-R$, we do the same thing, except that it's $e^{-x}$ that dominates the denominator, and $a+1$ has positive real part.