Inverse tangent of a complex variable Show that
$$\tan^{-1}(z) = \frac{i}{2}\ln\left(\frac{i + z}{1 - z}\right)$$

I tried this approach:
$$\tan(w) = z$$
$$\tan(w) = \frac{\sin(w)}{\cos(w)}$$
$$\tan(w) = \frac{\frac{e^{iw}-e^{-iw}}{2i}}{\frac{e^{iw}+e^{-iw}}{2}}$$
let $$ u = e^{iw}$$
$$\tan(w) = \frac{u - u^{-1}}{i(u + u^{-1})}$$
But I don't see a way from there
 A: A useful trick: $\frac{a}{b}=\frac{c}{d} \iff \frac{a+b}{a-b}=\frac{c+d}{c-d}$
\begin{align*}
  i\tan w &= \frac{e^{iw}-e^{-iw}}{e^{iw}+e^{-iw}} \\
  \frac{iz}{1} &= \frac{e^{iw}-e^{-iw}}{e^{iw}+e^{-iw}} \\
  \frac{1+iz}{1-iz} &= \frac{e^{iw}}{e^{-iw}} \\
  e^{2iw} &= \frac{1+iz}{1-iz} \\
  2iw &= \ln \frac{1+iz}{1-iz} \\
  w &= \frac{1}{2i} \ln \frac{1+iz}{1-iz} \\
    &= \frac{i}{2} \ln \frac{1-iz}{1+iz} \\
  \tan^{-1} z  &= \frac{i}{2} \ln \frac{i+z}{i-z}
\end{align*}
A: For any $y\in\mathbb{R}$, we have
$$
\log(1+iy)=\log\left(\sqrt{1+y^2}\right)+i\tan^{-1}(y)\tag{1}
$$
Therefore,
$$
\begin{align}
\tan^{-1}(y)
&=\frac1i\log\left(\frac{1+iy}{\sqrt{1+y^2}}\right)\\
&=\frac1{2i}\log\left(\frac{(1+iy)^2}{1+y^2}\right)\\
&=\frac1{2i}\log\left(\frac{1+iy}{1-iy}\right)\\
&=\frac i2\log\left(\frac{i+y}{i-y}\right)\tag{2}
\end{align}
$$
Since both sides of $(2)$ are analytic functions of $y$, $(2)$ can be extended at least to $y\in\mathbb{C}$ where $\left|y\right|\lt1$.
Using the identity
$$
\tan^{-1}\left(\frac1y\right)=\frac\pi2-\tan^{-1}(y)\tag{3}
$$
$(2)$ can be extended to $y\in\mathbb{C}$ where $\left|y\right|\gt1$.
Except for $y=\pm i$, $(2)$ can be extended to $\left|y\right|=1$ by continuity.
