proof of $\arctan(x)=\frac{i}{2}(\ln(x+i)-\ln(x-i)-i\pi)$ without solving $\int\frac{1}{x^2+1}dx$ So I know $\int\frac{1}{x^2+1}dx=\arctan(x)+c$
Now when i tried to integral $\frac{1}{x^2+1}$ in a different way i got this:
$$\frac{1}{x^2+1}=\frac{1}{(x-i)(x+i)}=\frac{A}{x-i}+\frac{B}{x+i}\\\implies1=Ax+Ai+Bx-Bi=x(A+B)+i(A-B)\\\implies
\begin{cases}
A+B=0
\\[2ex]
A-B=\frac{1}{i}=-i
\end{cases}\\\implies2A=-i\implies A=\frac{-i}{2}\implies B=\frac{i}{2}$$
So in the end i get:$$\int\frac{1}{x^2+1}dx=\int\frac{i}{2(x+i)}-\frac{i}{2(x-i)}dx=\frac{i}{2}\int\frac{1}{(x+i)}-\frac{1}{(x-i)}dx$$
After integrating this i get $\frac{i}{2}(\ln(x+i)-\ln(x-i)+C)$ after comparing this to $\arctan(x)$ at $x=0$ i find $C=-i\pi$
$\therefore~\arctan(x)=\frac{i}{2}(\ln(x+i)-\ln(x-i)-i\pi)$
now my question is how can i prove that without using the integral
 A: By definition of $\ln$ for complex numbers:
$$\ln(x+i)=\ln|x+i|+i\operatorname{Arg}(x+i)$$
where $\operatorname{Arg}$ is the principal value of the $\arg$
It is clear that:
$$\operatorname{Arg}(x+i)=\begin{cases}\arctan\frac{1}{x}&\text{ if }x\ge0\\\pi+\arctan\frac{1}{x}&\text{ if }x<0\end{cases}$$
Analogously:
$$\ln(x-i)=\ln|x-i|+i\operatorname{Arg}(x-i)$$
In this case it is:
$$\operatorname{Arg}(x-i)=\begin{cases}-\arctan\frac{1}{x}&\text{ if }x\ge0\\-\pi-\arctan\frac{1}{x}&\text{ if }x<0\end{cases}$$
Moreover observe that:
$|x+i|=|x-i|$
Putting everything together you get:
$\frac{i}{2}(\ln(x+i)-\ln(x-i)-i\pi)=\begin{cases}\stackrel{x\ge0}=\frac{i}{2}(2i\arctan\frac{1}{x}-i\pi)&=-\arctan\frac{1}{x}+\frac{\pi}{2}=\\\stackrel{x<0}=\frac{i}{2}(2i\pi+2i\arctan\frac{1}{x}-i\pi)&=-\arctan\frac{1}{x}-\frac{\pi}{2}=\end{cases}=\arctan x$
A: Perhaps using Euler? 
$$ z= \tan w = \frac{\sin w}{\cos w} = \frac{1}{i}\frac{e^{iw}-e^{-iw}}{e^{iw}+e^{iw}} = \frac{1}{i} \frac{e^{2iw}-1}{e^{2iw}+1}$$
so for any $k\in {\Bbb Z}$ $$e^{2iw} = e^{2i(w -k)} = \frac{1+iz}{1-iz}$$
whence 
$$ w = \frac{1}{2i} \log \left( \frac{1+iz}{1-iz} \right) +  k \pi$$
where the choice of $k\in {\Bbb Z}$ depends upon the cut you want.
$k=0$ corresponds to standard choices of $\log(1)=0$ and $\arctan 0=0$.
A: You found
$$\arctan x=\dfrac{i}{2}\Big(\ln(x+i)-\ln(x-i)-i\pi\Big)=\dfrac{i}{2}\ln\dfrac{x+i}{x-i}+\dfrac{\pi}{2}=-\dfrac{i}{2}\ln\dfrac{x-i}{x+i}+\dfrac{\pi}{2}$$
let $x=\dfrac1z$ so
$$\arctan\dfrac1z=-\dfrac{i}{2}\ln\dfrac{1-iz}{1+iz}+\dfrac{\pi}{2}$$
and then
$$\dfrac{i}{2}\ln\dfrac{1-iz}{1+iz}=\dfrac{\pi}{2}-\arctan\dfrac1z=\arctan z$$
as you want!
A: Here is another way to look at this: consider that $z=|z|e^{i\theta}$ and that $z^*=|z^*|e^{-i\theta}$. Then
$$
\frac{|z|}{|z^*|}=e^{2i\theta}\\
\theta=\frac{1}{2i}(\ln |z|-\ln |z^*|)
$$
Now, let $z=x+i$, then
$$
\theta=\cot^{-1}x=\frac{1}{2i}(\ln |x+i|-\ln |x-i|)
$$
Now,
$$
\cot^{-1}x+\tan^{-1}x=\frac{\pi}{2}
$$
so that
$$
\begin{align}
\tan^{-1}x
&=-\frac{1}{2i}(\ln |x+i|-\ln |x-i|)+\frac{\pi}{2}\\
&=\frac{i}{2}(\ln |x+i|-\ln |x-i|-i\pi)
\end{align}
$$
