Finding the closed form of $\int _0^{\infty }\frac{\ln \left(1+ax\right)}{1+x^2}\:\mathrm{d}x$ I solved a similar case which is also a very well known integral
$$\int _0^{\infty }\frac{\ln \left(1+x\right)}{1+x^2}\:\mathrm{d}x=\frac{\pi }{4}\ln \left(2\right)+G$$
My teacher gave me a hint which was splitting the integral at the point $1$,
$$\int _0^1\frac{\ln \left(1+x\right)}{1+x^2}\:\mathrm{d}x+\int _1^{\infty }\frac{\ln \left(1+x\right)}{1+x^2}\:\mathrm{d}x=\int _0^1\frac{\ln \left(1+x\right)}{1+x^2}\:\mathrm{d}x+\int _0^1\frac{\ln \left(\frac{1+x}{x}\right)}{1+x^2}\:\mathrm{d}x$$
$$2\int _0^1\frac{\ln \left(1+x\right)}{1+x^2}\:\mathrm{d}x-\int _0^1\frac{\ln \left(x\right)}{1+x^2}\:\mathrm{d}x=\frac{\pi }{4}\ln \left(2\right)+G$$
I used the values for each integral since they are very well known.
My question is, can this integral be generalized for $a>0$?, in other words can similar tools help me calculate
$$\int _0^{\infty }\frac{\ln \left(1+ax\right)}{1+x^2}\:\mathrm{d}x$$
 A: You can evaluate this integral with Feynman's trick,
$$I\left(a\right)=\int _0^{\infty }\frac{\ln \left(1+ax\right)}{1+x^2}\:dx$$
$$I'\left(a\right)=\int _0^{\infty }\frac{x}{\left(1+x^2\right)\left(1+ax\right)}\:dx=\frac{1}{1+a^2}\int _0^{\infty }\left(\frac{x+a}{1+x^2}-\frac{a}{1+ax}\right)\:dx$$
$$=\frac{1}{1+a^2}\:\left(\frac{1}{2}\ln \left(1+x^2\right)+a\arctan \left(x\right)-\ln \left(1+ax\right)\right)\Biggr|^{\infty }_0=\frac{1}{1+a^2}\:\left(\frac{a\pi \:}{2}-\ln \left(a\right)\right)$$
To find $I\left(a\right)$ we have to integrate again with convenient bounds,
$$\int _0^aI'\left(a\right)\:da=\:\frac{\pi }{2}\int _0^a\frac{a}{1+a^2}\:da-\int _0^a\frac{\ln \left(a\right)}{1+a^2}\:da$$
$$I\left(a\right)=\:\frac{\pi }{4}\ln \left(1+a^2\right)-\int _0^a\frac{\ln \left(a\right)}{1+a^2}\:da$$
To solve $\displaystyle\int _0^a\frac{\ln \left(a\right)}{1+a^2}\:da$ first IBP.
$$\int _0^a\frac{\ln \left(a\right)}{1+a^2}\:da=\ln \left(a\right)\arctan \left(a\right)-\int _0^a\frac{\arctan \left(a\right)}{a}\:da=\ln \left(a\right)\arctan \left(a\right)-\text{Ti}_2\left(a\right)$$
Plugging that back we conclude that
$$\boxed{I\left(a\right)=\:\frac{\pi }{4}\ln \left(1+a^2\right)-\ln \left(a\right)\arctan \left(a\right)+\text{Ti}_2\left(a\right)}$$
Where $\text{Ti}_2\left(a\right)$ is the Inverse Tangent Integral.
The integral you evaluated can be proved with this,
$$I\left(1\right)=\int _0^{\infty }\frac{\ln \left(1+x\right)}{1+x^2}\:dx=\frac{\pi }{4}\ln \left(2\right)-\ln \left(1\right)\arctan \left(1\right)+\text{Ti}_2\left(1\right)$$
$$=\frac{\pi }{4}\ln \left(2\right)+G$$
Here $G$ denotes the Catalan's constant.
A: As @Dennis Orton answered, Feynman trick is certainly the most elegant approach for the solution.
What you could also do is
$$\frac 1 {1+x^2}=\frac i 2 \left( \frac 1 {x+i}-\frac 1 {x-i}\right)$$ and we face two integrals
$$I_k=\int \frac {\log(1+ax)}{x+k i}\,dx=\text{Li}_2\left(\frac{1+a x}{1-i a k}\right)+\log (a x+1) \log \left(1-\frac{1+a
   x}{1-i a k}\right)$$
$$J_k=\int_0^p \frac {\log(1+ax)}{x+k i}\,dx=\text{Li}_2\left(\frac{i (1+a p)}{a k+i}\right)+\log (1+a p) \log \left(\frac{a
   (k-i p)}{a k+i}\right)-\text{Li}_2\left(\frac{i}{a k+i}\right)$$ Computing $\frac i 2(J_1-J_{-1})$ and making $p \to\infty$, assuming $a>0$ you should end with
$$\int _0^{\infty }\frac{\log \left(1+ax\right)}{1+x^2}\,dx=\frac{1}{4} \pi  \log \left(1+a^2\right)+\log (a) \cot ^{-1}(a)+\frac{1}{2} i
   \left(\text{Li}_2\left(-\frac{i}{a}\right)-\text{Li}_2\left(\frac{i}{a}\right)
   \right)$$
