Show that for $-1<p<1$, $$ \int_0^{\infty} \frac{\cos(px)}{\cosh x} \,dx = \frac{\pi}{2\cosh(p\pi/2)}.$$
I make L.S to $$\frac{e^{ipx}+e^{-ipx}}{e^{x}+e^{-x}}$$ and I cannot approach next step.
Show that for $-1<p<1$, $$ \int_0^{\infty} \frac{\cos(px)}{\cosh x} \,dx = \frac{\pi}{2\cosh(p\pi/2)}.$$
I make L.S to $$\frac{e^{ipx}+e^{-ipx}}{e^{x}+e^{-x}}$$ and I cannot approach next step.
Consider
$$f(z) = \frac{e^{i pz}}{\sinh(z)}$$
If we integrate around a contour of height $\pi $ and stretch it to infinity we get
By taking $ T \to \infty $
$$\color{red}{\int^{i\pi/2+\infty}_{-i\pi/2+\infty}f(x)\,dx}+\color{blue}{\int^{i\pi/2-\infty}_{i\pi/2+\infty}f(x)\,dx}+\\\color{red}{\int^{-i\pi/2-\infty}_{i\pi/2-\infty}f(x)\,dx}+ \color{blue}{\int^{-i\pi/2+\infty}_{-i\pi/2-\infty}f(x)\,dx} = 2\pi i \mathrm{Res}(f,0)$$
Consider
$$\color{blue}{\int^{-i\pi/2+\infty}_{-i\pi/2-\infty}\frac{e^{ipx}}{\sinh(x)}\,dx}$$
Let $x = -\pi i/2+y $
$$ i e^{\frac{\pi p}{2}}\int^{\infty}_{-\infty}\frac{e^{ipy}}{ \cosh(y)}\,dy$$
Similarly we have for
$$\color{blue}{\int^{i\pi/2-\infty}_{i\pi/2+\infty}\frac{e^{ipx}}{\sinh(x)}\,dx}$$
By letting $ x =\pi i/2+ y $
$$ i e^{-\frac{\pi p}{2}}\int^{\infty}_{-\infty}\frac{e^{ipy}}{ \cosh(y)}\,dy$$
The other integrals go to 0 hence
$$i \left(e^{\frac{\pi p}{2}}+e^{- \frac{\pi p}{2}} \right)\int^{\infty}_{-\infty}\frac{e^{ipy}}{ \cosh(y)}\,dy =2\pi i \mathrm{Res}(f,0)$$
Calculating the residue we have
$$\mathrm{Res}(f,0) = \lim_{z \to 0} z\frac{e^{ipz}}{\sinh(z)} = \lim_{z \to 0}\frac{e^{ipz}}{\cosh(z)} = 1$$
Using that we get
$$\int^{\infty}_{-\infty}\frac{e^{ipy}}{ \cosh(y)}\,dy =\frac{2\pi}{e^{\frac{\pi p}{2}}+e^{- \frac{\pi p}{2}}} $$
By taking the real part
$$\boxed{\int^{\infty}_{0}\frac{\cos(py)}{ \cosh(y)}\,dy =\frac{\pi}{2} \, \mathrm{sech}\left( \frac{\pi}{2} p\right)}$$
I thought it might be instructive to present a purely real analysis approach.
Note that we can write
$$\begin{align} \int_0^\infty \frac{\cos(px)}{\cosh(x)}\,dx&=2\int_0^\infty \frac{e^{-x}\cos(px)}{1+e^{-2x}}\,dx\tag 1\\\\ &=2\sum_{n=0}^\infty (-1)^n\int_0^\infty e^{-(2n+1)x}\cos(px)\,dx\tag 2\\\\ &=2\sum_{n=0}^\infty (-1)^n\frac{2n+1}{(2n+1)^2+p^2} \tag 3\\\\ &=\frac{\pi}{2}\text{sech}\left(\frac{\pi p}{2}\right)\tag 4 \end{align}$$
NOTES:
In going from $(1)$ to $(2)$, we expanded $\frac{1}{1+e^{-2x}}$ in a geometric series and interchanged the order of the series and integral. Uniform convergence guarantees the legitimacy of interchanging the order of operations.
In going from $(2)$ to $(3)$, we carried out the integral.
In going from $(3)$ to $(4)$, we made use of the analysis in THIS ANSWER, in which I developed the partial fraction representation of $\sec(\pi a/2)$.
Then, we simply noted that for $a=ip$ we obtain
$$2\sum_{n=0}^\infty(-1)^n \frac{2n+1}{(2n+1)^2+p^2}=\frac{\pi}{2}\sec(i\pi p/2)=\frac{\pi}{2}\text{sech}(\pi p/2)$$
Try changing limits of the function according to value of p for cosh and cos and substitute.