Question: Integrate$$\mathscr{I}=\int\limits_{-\infty}^{\infty}dx\,\frac {\log(1+x^2)}{1+x^2}$$
I tried using a semicircle with radius $R$ with a smaller semicircle detour inside
So we have that$$\oint\limits_{C}dz\, f(z)=\int\limits_r^Rdx\, f(x)+\int\limits_{\gamma_R}dz\, f(z)+\int\limits_{-R}^{-r}dx\,\frac {\log|1+x^2|+i\arg(1+x^2)}{1+x^2}+\int\limits_{\gamma_r}dz\, f(z)$$where $f(z)$ represents the integrand. However, I'm having trouble computing the residue at $z=i$ because the limit leads to infinity.
Are branch cuts required? If so, is it possible for you to walk me through it? I'm not very familiar with them...
It is well known that a good alternative to contour integration is differentiation under the integral sign: it perfectly applies here, so I am going to outline an alternative approach. For any $a>\frac{1}{2}$, by exploiting symmetry and by enforcing the substitution $\frac{1}{1+x^2}=u$, we have $$ \int_{-\infty}^{+\infty}\frac{dx}{(1+x^2)^a} = \frac{\sqrt{\pi}\,\Gamma\left(a-\tfrac{1}{2}\right)}{\Gamma(a)}$$ by Euler's Beta function. By differentiating both sides with respect to $a$, and exploiting $\frac{d}{da}\,f=f\cdot\frac{d}{da}\log f$, we get: $$ \int_{-\infty}^{+\infty}\frac{-\log(1+x^2)}{(1+x^2)^a}\,dx = \frac{\sqrt{\pi}\,\Gamma\left(a-\tfrac{1}{2}\right)}{\Gamma(a)}\left[\psi\left(a-\tfrac{1}{2}\right)-\psi(a)\right]$$ and by evaluating both sides at $a=1$: $$ \int_{-\infty}^{+\infty}\frac{\log(1+x^2)}{(1+x^2)}\,dx = \pi\left[\psi(1)-\psi\left(\tfrac{1}{2}\right)\right]=\color{red}{2\pi\log 2}.$$ The equivalent claim $$ \int_{0}^{\pi/2}\log\sin\theta\,d\theta = -\frac{\pi}{2}\log 2$$ can also be proved through $\prod_{k=1}^{n-1}\sin\left(\frac{\pi k}{n}\right)=\frac{2n}{2^n}$ and Riemann sums, or just by symmetry tricks.