By partial fractions I've got $\frac{1}{1+x^2}=\frac{1}{2i}\left(\frac{1}{x-i}-\frac{1}{x+i}\right)$ Then integrating $\frac{1}{2i}\int\left(\frac{1}{x-i}-\frac{1}{x+i}\right)dx=\frac{1}{2i}(\ln(x-i)-\ln(x+i))$ If $x-i=R_1e^{i\phi_1}$ and $x+i=R_2e^{i\phi_2}$ then $\frac{1}{2i}(\ln(x-i)-\ln(x+i))=\frac{1}{2i}(\ln(R_1)-\ln(R_2)+i(\phi_1-\phi_2))=\frac{1}{2}(\phi_1-\phi_2)$ But now I put that $\phi_1=\arctan\frac{-1}{x}$ and $\phi_2=\arctan\frac{1}{x}$ so: $\arctan(x)=^?\frac{1}{2}\left(\arctan\frac{-1}{x}-\arctan\frac{1}{x}\right)$ I tried some values and looks false. The most confusing thing is that $\frac{d}{dx}\frac{1}{2}\left(\arctan\frac{-1}{x}-\arctan\frac{1}{x}\right)=\frac{1}{1+x^2}$(Something is happening with the argument function.) What's the mistake?
EDIT: Hans Lundmark wisely said in a comment there's only thing left: the constant $\arctan(x)=\frac{1}{2}\left(\arctan\frac{-1}{x}-\arctan\frac{1}{x}\right)+\frac{\pi}{2}$
Now the question is: how should I find this constant in future integrations?