How can I calculate this$\int_{0}^{+\infty}(\frac{1}{x-i}-\frac{1}{x+i})dx$? $x \in \Re$
If we considered $i$ just like a real constant, we would get the following(Considering that the integrand is "positive" - $\Re(x+i)>0$ and $\Re(x-i)>0$) : $Ln\frac{x-i}{x+i}|_{0}^{+\infty} = ln|1|-ln|1|+i[arg(1)-arg(-1) + 2\pi k] =i(\pi k+2\pi k)$ But...the last calculations are kind of strange, because we have an addend $2\pi k$.
You can just add the fractions to get $$2i\int_0^\infty\frac1{x^2+1}\mathrm{d}x=2i\left[\arctan{(x)}\right]_0^\infty=2i\left(\frac\pi2-0\right)=\pi i$$