Evaluate: $\int \frac{2}{(1-x)(1+x^2)}dx$ Given $\int \frac{2}{(1-x)(1+x^2)}dx$
The most obvious approach is to use Partial fractions
Let $\frac{2}{(1-x)(1+x^2)}=\frac{A}{1-x}+\frac{Bx+C}{1+x^2}$
$\Rightarrow \frac{2}{(1-x)(1+x^2)}=\frac{A+Ax^2+Bx-Bx^2+C-Cx}{(1-x)(1+x^2)}$
We get $A=1, B=1, C=1$
The integral now becomes
$\int[\frac{1}{1-x}+\frac{x+1}{1+x^2}]dx$
$\Rightarrow \int[\frac{1}{1-x}+\frac{x}{1+x^2}+\frac{1}{1+x^2}]dx$
Now, we can simply integrate term by term
$\Rightarrow -\log|1-x|+\frac{\log(1+x^2)}{2}+\tan^{-1}x+c $
$\Rightarrow \log |\frac{\sqrt{1+x^2}}{1-x}|+\tan^{-1}x+c $
Please review my solution and if you have any other way of integrating then please share your solution.

$$\Im \left(\frac{1}{x-i}\right)=\frac{1}{1+x^2}$$
$$\int \frac{2}{(1-x)(1+x^2)}dx=\Im\int\frac{2}{(1-x)(x-i)}dx$$$$=\Im\int\frac{(1+i)((1-x)+(x-i))}{(1-x)(x-i)}dx=\Im\left[\int\frac{1+i}{x-i}dx+\int\frac{1+i}{1-x}dx\right]$$
$$=\Im\left[(1+i)\ln(x-i)-(1+i)\ln(1-x)\right]+c$$$$=\frac{1}{2}\ln(x^2+1)+\arctan x-\ln(1-x)+C$$
