I was looking at a couple of definite integrals on this site which had a combination of $\arctan(x)$ and $\ln(1+x^2)$ in the numerator, and I notices that in the solutions to these integrals there was a step relating these function using complex analysis which I didn't understand.
For example, in this answer it is stated that $$ \int _0^{\infty }\frac{\arctan ^2\left(x\right)\ln ^2\left(1+x^2\right)}{x\left(1+x^2\right)}\mathrm{d}x = -\frac{2}{3}\Re \left\{\int _0^{\infty }\frac{\ln ^4\left(\frac{i}{i+x}\right)}{x\left(1+x^2\right)}\mathrm{d}x\right\}+\frac{2}{3}\int _0^{\infty }\frac{\arctan ^4\left(x\right)}{x\left(1+x^2\right)}\mathrm{d}x+\frac{1}{24}\int _0^{\infty }\frac{\ln ^4\left(1+x^2\right)}{x\left(1+x^2\right)}\mathrm{d}x $$ where the product of $\arctan ^2\left(x\right)\ln ^2\left(1+x^2\right)$ has been "split up" into integrals involving only logarithms or arctangent, plus the real part of another complex logarithm. It is not obvious to me how this step takes place.
Another example is in this answer where it is stated that $$ \int_0^1 \frac{\Re\left\{\left(2\arctan(x)i-\ln\left(\frac{(1-x)^2}{1+x^2}\right) \right)^n\right\}}{x}dx = -2^n \int_0^1 \frac{\Re\{(\log(1-x)-\log(1+ix))^n\}}{x}dx $$ Where now the expression managed to get rid of the $\arctan(x)$ part completely.
Could somebody tell me what complex numbers property is being used in these integral manipulations to relate arctangent and logarithms? Thank you very much!