Complex Integral : How can I evaluate $\int_{C_R} f(z) dz$? I have to calculate $I$ ,using complex integral.
\begin{equation}
I:=\displaystyle\int_{-\infty}^{\infty} \dfrac{\text{log}{\sqrt{x^2+a^2}}}{1+x^2}.(a>0)
\end{equation}
Let $f(z)=\dfrac{\text{log}(z+ia)}{1+z^2}$.
$
C_R : z=Re^{i\theta}, \theta : 0 \to \pi.$
$C_1 : z=t, t : -R \to R.$
From Residue Theorem,
\begin{equation}
\displaystyle\int_{C_1} f(z) dz + \displaystyle\int_{C_R} f(z) dz = 2\pi i \text{Res}(f, i).
\end{equation}
If $R \to \infty$, $\displaystyle\int_{C_1} f(z) dz  \to \displaystyle\int_{-\infty}^{\infty} f(x) dx. $
And my mathematics book says that if $R \to \infty$, $\displaystyle\int_{C_R} f(z) dz \to 0.$ I cannot understand why this holds.
My attempt is following :
\begin{align}
\Bigg|\displaystyle\int_{C_R} f(z) dz \Bigg|
&=\Bigg|\displaystyle\int_0^{\pi} f(Re^{i\theta}) i Re^{i\theta} d\theta \Bigg| \\
&\leqq \displaystyle\int_0^{\pi} \Bigg| R \dfrac{\text{log} (Re^{i\theta} + ia)}{1+R^2e^{2i\theta}} \Bigg| d\theta \\
&\leqq \displaystyle\int_0^{\pi} \dfrac{R}{R^2-1} \Bigg| \text{log} (Re^{i\theta}+ia) \Bigg| d\theta \\
&= \displaystyle\int_0^{\pi} \dfrac{R}{R^2-1} \Bigg| \text{log} (R\cos \theta+i(R\sin \theta +a)) \Bigg| d\theta
\end{align}
I expect that
$ \displaystyle\int_0^{\pi} \dfrac{R}{R^2-1} \Bigg| \text{log} (R\cos \theta+i(R\sin \theta +a)) \Bigg| d\theta \to 0$,
but I cannot prove this.
I would like to give me some ideas.
 A: $$I(a):=\int_{-\infty}^{\infty} \frac{\ln\sqrt{x^2+a^2}}{1+x^2}dx=
\int_0^{\infty} \frac{\ln(x^2+a^2)}{1+x^2}dx$$
$$\frac{dI}{da}=\int_0^{\infty} \frac{2a}{(1+x^2)(x^2+a^2)}dx$$
$$\int \frac{2a}{(1+x^2)(x^2+a^2)}dx=\frac{2}{a^2-1}\tan^{-1}(\frac{x}{a})-\frac{2a}{a^2-1}\tan^{-1}(x)$$
$$\frac{dI}{da}=\frac{2}{a^2-1}\frac{\pi}{2}-\frac{2a}{a^2-1}\frac{\pi}{2}$$
After simplification :
$$\frac{dI}{da}=\frac{\pi}{a+1}$$
$$I(a)=\pi\ln(a+1)+C$$
In order to determine $C$ we compute the integral for a particular value of $a$, for example $a=0$ :
$$I(0)=\int_0^{\infty} \frac{\ln(x^2)}{1+x^2}dx$$
Change of variable $\quad x=\frac{1}{t}$ :
$$I(0)=\int_{\infty}^0 \frac{\ln(\frac{1}{t^2})}{1+\frac{1}{t^2}}(-\frac{dt}{t^2})=
-\int_0^{\infty} \frac{-\ln(t^2)}{t^2+1}(-dt)=-\int_0^{\infty} \frac{\ln(t^2)}{t^2+1}dt$$
This implies
$$\int_0^{\infty} \frac{\ln(x^2)}{1+x^2}dx=-\int_0^{\infty} \frac{\ln(t^2)}{1+t^2}dt=0\quad\text{thus}\quad I(0)=0.$$
$$I(0)=\pi\ln(0+1)+C\quad\implies\quad C=0$$
$$\boxed{I(a):=\int_{-\infty}^{\infty} \frac{\ln\sqrt{x^2+a^2}}{1+x^2}dx=\pi\ln(a+1)}$$
A: I fact the integral can be evaluated by means of contour integrating in the complex plane.
Let' consider the following closed contour C in the upper half-plane with the cut from $x=ia$ to $x=0$. We also choose the integrand $f(x)=\frac{\log(x^2+a^2)}{1+x^2}$ on the positive part of axis (right side). For the convenience of calculations we take $a<1$.
$x=i$  is a simple pole, and $x=ia$ is a logarithm branch point.

Due to the cut our integrand is a single-valued function in the upper half-plane. We integrate from $x=0$  along the positive axis, then along a big circle (radius R) counter clockwise, then along negative part of axis, from $x=0$ to $x=ia$, clockwise around the point $x=ia$ (circle of radius $r$) and then from $x=ia$ along the second bank of the cut to the initial starting point. It is easy to see that the integral along the big circle $\to0$ as soon as $R\to{\infty}$, and so does the integral around the point $x=ia$ when $r\to0$ . In the left quarter of half-plane (on the negative part of axis) the function $(x^2+a^2)$ will get the factor $\exp(2\pi{i})$ due to the logarithm branch point $x=ia$ (which we go around in the positive direction when integrating along a big circle).
Taking all together we get
$\oint_C\frac{\log(x^2+a^2)}{1+x^2}$=$\int_0^{\infty}\frac{\log(x^2+a^2)}{1+x^2}dx+\int_R+\int_{-\infty}^0\frac{\log[(x^2+a^2)\exp(2\pi{i})]}{1+x^2}dx$+$\int_0^{ia}\frac{\log[(x^2+a^2)\exp(2\pi{i})]}{1+x^2}dx+\int_r + $
$+\int_{ia}^{0}\frac{\log(x^2+a^2)}{1+x^2}dx=$$2\pi{i}Res_{x=i}\frac{\log(x^2+a^2)}{1+x^2}$
Setting $R\to{\infty}$ and $r\to0$, and taking into consideration that there are integrals cancelling each other, we get:
$2I=\int_{-\infty}^{\infty}\frac{\log(x^2+a^2)}{1+x^2}dx=$$-\int_{-\infty}^{0}\frac{2\pi{i}}{1+x^2}dx-\int_0^{ia}\frac{2\pi{i}}{1+x^2}dx+2\pi{i}Res_{x=i}\frac{\log(x^2+a^2)}{1+x^2}$.
When calculating the residual we have to bear in mind that $\log(a-1)=\log[\exp(\pi{i}(1-a)]=\pi{i}\log(1-a)$- due to the choice of logarithm branch (and the choice $a<1$).
Finally we get $2I=-{\pi}^2i+2\pi\int_0^{a}\frac{1}{1-x^2}dx+\pi\log(a^2-1)=\pi\log(\frac{1+a}{1-a})+\pi\log[(1+a)(1-a)]$.
$$I(a)=\int_{-\infty}^{\infty} \dfrac{\text{log}{\sqrt{x^2+a^2}}}{1+x^2}=\frac{1}{2}\int_{-\infty}^{\infty} \dfrac{\text{log}(x^2+a^2)}{1+x^2}=\pi\log(1+a); a<1$$
Calculations for $a>1$ can be done in the same fashion.
