Use residues to evaluate $\int_0^\infty \frac{\cosh(ax)}{\cosh(x)}\,\mathrm{d}x$, where $|a|<1$ Use residues to evaluate $$
\int_0^\infty \frac{\cosh(ax)}{\cosh(x)}\,\mathrm{d}x
$$
where $|a|<1$.
Try considering the integral of the form 
$$
\int_C \frac{\exp(az)}{\cosh(z)}\,\mathrm dz,
$$
where $C$ is the contour given by $y=0,\, y=\pi,\, x=-R,\, x=R$.

This doesn't use residues until we use
$$
\sum_{k\in\mathbb{Z}}\frac{(-1)^k}{z+k}=\pi\csc(\pi z)
$$
which can be proven using residues.
We just expand things in powers of $e^x$:
$$
\begin{align}
&\int_0^\infty\frac{\cosh(ax)}{\cosh(x)}\,\mathrm{d}x\\
&=\int_0^\infty e^{(a-1)x}\frac{1+e^{-2ax}}{1+e^{-2x}}\,\mathrm{d}x\\
&=\int_0^\infty\left(e^{(a-1)x}-e^{(a-3)x}+e^{(a-5)x}-\dots\right)\,\mathrm{d}x\\
&+\int_0^\infty\left(e^{(-a-1)x}-e^{(-a-3)x}+e^{(-a-5)x}-\dots\right)\,\mathrm{d}x\\
&=\frac1{1-a}-\frac1{3-a}+\frac1{5-a}-\dots\\
&+\frac1{1+a}-\frac1{3+a}+\frac1{5+a}-\dots\\
&=\frac1{a+1}-\frac1{a+3}+\frac1{a+5}-\dots\\
&-\frac1{a-1}+\frac1{a-3}-\frac1{a-5}-\dots\\
&=\frac12\left(\dots+\frac1{\frac{a+1}2-2}-\frac1{\frac{a+1}2-1}+\frac1{\frac{a+1}2}-\frac1{\frac{a+1}2+1}+\frac1{\frac{a+1}2+2}-\dots\right)\\
&=\frac12\pi\csc\left(\pi\frac{a+1}2\right)\\
&=\frac\pi2\sec\left(\frac\pi2a\right)
\end{align}
$$
