<s>[INST] how to solve $\int _0^1\frac{\ln \left(1+x\right)}{a^2+x^2}\:\mathrm{d}x$ 
how to solve $$\mathcal{J(a)}=\int _0^1\frac{\ln \left(1+x\right)}{a^2+x^2}\:\mathrm{d}x$$

i used the differentiation under the integral and got
\begin{align}
\mathcal{J(b)}&=\int _0^1\frac{\ln \left(1+bx\right)}{a^2+x^2}\:\mathrm{d}x
\\[3mm]
\mathcal{J'(b)}&=\int _0^1\frac{x}{\left(a^2+x^2\right)\left(1+bx\right)}\:\mathrm{d}x
\\[3mm]
&=\frac{a^2b}{1+a^2b^2}\int _0^1\frac{1}{a^2+x^2}\:\mathrm{d}x+\frac{1}{1+a^2b^2}\int _0^1\frac{x}{a^2+x^2}\:\mathrm{d}x-\frac{b}{1+a^2b^2}\int _0^1\frac{1}{1+bx}\:\mathrm{d}x
\\[3mm]
&=\frac{ab}{1+a^2b^2}\operatorname{atan} \left(\frac{1}{a}\right)+\frac{1}{2}\frac{\ln \left(1+a^2\right)}{1+a^2b^2}-\frac{\ln \left(a\right)}{1+a^2b^2}-\frac{\ln \left(1+b\right)}{1+a^2b^2}
\end{align}
But we know that $\mathcal{J}(1)=\mathcal{J(a)}$ and $\mathcal{J}(0)=0$
\begin{align}
\int_0^1\mathcal{J'(b)}\:\mathrm{d}b&=a\:\operatorname{atan} \left(\frac{1}{a}\right)\int _0^1\frac{b}{1+a^2b^2}\:\mathrm{d}b+\frac{\ln \left(1+a^2\right)}{2}\int _0^1\frac{1}{1+a^2b^2}\:\mathrm{d}b-\ln \left(a\right)\int _0^1\frac{1}{1+a^2b^2}\:\mathrm{d}b
\\
&-\int _0^1\frac{\ln \left(1+b\right)}{1+a^2b^2}\:\mathrm{d}b
\\[3mm]
\mathcal{J(a)}&=\frac{1}{2a}\operatorname{atan} \left(\frac{1}{a}\right)\ln \left(1+a^2\right)+\frac{1}{2a}\ln \left(1+a^2\right)\operatorname{atan} \left(a\right)-\frac{1}{a}\ln \left(a\right)\:\operatorname{atan} \left(a\right)-\underbrace{\int _0^1\frac{\ln \left(1+b\right)}{1+a^2b^2}\:\mathrm{d}b}_{\mathcal{I}}
\end{align}
but how to calculate ${\mathcal{I}}$, i tried using the same technique but it didnt work
 [/INST] Repeating your calculations using Feynman's trick
$$J'(b)=\frac{-\log \left(a^2\right)+\log \left(a^2+1\right)+2 a b \cot ^{-1}(a)-2 \log
   (b+1)}{2 (a^2 b^2+1)}$$
$$J(b)=\int\frac{-\log \left(a^2\right)+\log \left(a^2+1\right)+2 a b \cot ^{-1}(a)}{2 (a^2 b^2+1)}\,db-\int\frac{\log(b+1)}{ a^2 b^2+1}\,db$$ The first integral is simple
$$J_1(b)=\int\frac{-\log \left(a^2\right)+\log \left(a^2+1\right)+2 a b \cot ^{-1}(a)}{2 (a^2 b^2+1)}\,db$$
$$J_1(b)=\frac{\cot ^{-1}(a) \log \left(a^2 b^2+1\right)+\left(\log
   \left(a^2+1\right)-\log \left(a^2\right)\right) \tan ^{-1}(a b)}{2 a}$$
$$K_1=\int_0 ^1\frac{-\log \left(a^2\right)+\log \left(a^2+1\right)+2 a b \cot ^{-1}(a)}{2 (a^2 b^2+1)}\,db$$
$$K_1=\frac{\left(\log \left(a^2+1\right)-\log \left(a^2\right)\right) \tan
   ^{-1}(a)+\log \left(a^2+1\right) \cot ^{-1}(a)}{2 a}$$
More tedious is the second integral
$$J_2(b)=\int\frac{\log(b+1)}{ a^2 b^2+1}\,db$$ $$J_2(b)=\frac{i \left(\text{Li}_2\left(\frac{a
   (b+1)}{a-i}\right)-\text{Li}_2\left(\frac{a (b+1)}{a+i}\right)+\log (b+1)
   \left(\log \left(1-\frac{a (b+1)}{a-i}\right)-\log \left(1-\frac{a
   (b+1)}{a+i}\right)\right)\right)}{2 a}$$
$$K_2(b)=\int_0^1\frac{\log(b+1)}{ a^2 b^2+1}\,db=$$
$$\frac{i \left(-\text{Li}_2\left(\frac{a}{a-i}\right)+\text{Li}_2\left(\frac{2
   a}{a-i}\right)+\text{Li}_2\left(\frac{a}{a+i}\right)-\text{Li}_2\left(\frac{2
   a}{a+i}\right)+\log (2) \left(\log \left(-\frac{a+i}{a-i}\right)-\log
   \left(-\frac{a-i}{a+i}\right)\right)\right)}{2 a}$$ which, for sure, is a real number.
Remark
I think that this could have benn done without Feynman's trick
$$\frac{\log \left(1+x\right)}{a^2+x^2}=\frac{\log \left(1+x\right)}{(x+i a)(x-i a)}$$
$$\int \frac{\log \left(1+x\right)}{a^2+x^2}\,dx=\frac i {2a}\left(\int \frac{\log \left(1+x\right)}{x+i a}\,dx-\int \frac{\log \left(1+x\right)}{x-i a}\,dx  \right)$$
$$\int \frac{\log \left(1+x\right)}{x+i a}\,dx=\text{Li}_2\left(\frac{x+1}{1-i a}\right)+\log (x+1) \log \left(1-\frac{x+1}{1-ia}\right)$$
$$\int \frac{\log \left(1+x\right)}{x-i a}\,dx=\text{Li}_2\left(\frac{x+1}{1+i a}\right)+\log (x+1) \log \left(1-\frac{x+1}{1+ia}\right)$$
</s>