an integral from the tables The following integral occurs in the book, “Integrals and Series“ v. I , Prudnikov et all, page 542:
$\displaystyle \int_{0}^{\infty}{\ln|\cos(ax)|\frac{1}{x^2+z^2}dx}=\frac{\pi}{2z}\ln{\frac{1+e^{-2az}}{2}}$
I have had no luck in verifying this integral. Can you help?
 A: $I=\int_{0}^{\infty}{\ln|\cos(ax)|\frac{1}{x^2+b^2}dx}=\frac{a}{2}\int_{0}^{\infty}{\ln(\cos^2 t)\frac{1}{t^2+(ab)^2}dt}$
Let's denote $ab=y$. Due to periodicity of $\cos^2 t$ we can write
$$I=\frac{a}{4}\int_{0}^{\pi}{\ln(\cos^2 t)\sum_{k=-\infty}^\infty\frac{1}{(t+\pi k)^2+y^2}dt}$$
Let's evaluate $S=\sum_{k=-\infty}^\infty\frac{1}{(t+\pi k)^2+y^2}$ first.
Integrating along a big circle (of radius $R$) in the complex plane the function $\pi \cot(\pi z)\frac{1}{(t+\pi z)^2+y^2}$ we get zero at $R\to \infty$, because the integrand declines rapidly enough. Therefore,
$$\oint_R=0=2\pi i\sum Res\, \pi \cot(\pi z)\frac{1}{(t+\pi z)^2+y^2}$$
$$S=-Res_{(z=-t/\pi\pm iy/\pi)}\pi \cot(\pi z)\frac{1}{(t+\pi z)^2+y^2}$$
We get
$$S=\frac{1}{2iy}\big(\cot (t+iy)-\cot(t-iy)\big)=-\frac{1}{y}\Im\cot(t+iy)$$
Using $\cos^2t=\frac{1}{4}(e^{2it}+1)(e^{-2it}+1)$ we can write
$$I=\frac{a}{4y}\int_0^\pi\ln\frac{(e^{2it}+1)(e^{-2it}+1)}{4}\Im\Big(\frac{e^{2it}+e^{2y}}{e^{2it}-e^{2y}}i\Big)dt$$
$$=\frac{a}{8y}\int_0^{2\pi}\ln\frac{(e^{it}+1)(e^{-it}+1)}{4}\Im\Big(\frac{e^{it}+e^{2y}}{e^{it}-e^{2y}}i\Big)dt$$
It is very natural to evaluate this integral via contour integration, using variables  $z=e^{±it}$ , integrating clockwise ( $\ln(e^{−it}+1)$ ) and counter-clockwise ( $\ln(e^{it}+1)$ ). To close the contours, we have to add small half-circles around  $z=-1$  - integrals along these half-circles give zero contribution (due t0 $r\ln r\to 0$ at $r\to 0$).
There are two simple poles inside the contour: at  $z=e^{−2y}$ and at  $z=0 $. Let's also suppose that $y>0$. In this case
$$I=-\frac{a}{8y} \,2\pi  Res_{z=0}\frac{z+e^{2y}}{z-e^{2y}}\frac{\ln(z+1)-2\ln2}{z}+\frac{a}{8y} \,2\pi  Res_{z=e^{-2y}}\frac{z+e^{-2y}}{z-e^{-2y}}\frac{\ln(z+1)}{z}$$
The straightforward evaluation gives
$$I=-\frac{\pi a\ln2}{2y}e^{-2y}+\frac{\pi a}{2y}\ln(1+e^{-2y})=\frac{\pi}{2b}\ln{\frac{1+e^{-2ab}}{2}}$$
