<s>[INST] Find a condition on real numbers $a$ and $b$ such that $\left(\frac{1+iz}{1-iz}\right)^n = a+ib$ has only real solutions I´m new on this. I need to find a condition that relates  two real numbers $a$ and $b$ such that 
 $$\left(\frac{1+iz}{1-iz}\right)^n = a+ib$$
has only real solutions
This is what I got till now.
$$\left(\frac{1+i(a+ib)}{1-i(a+ib)}\right)^n = a+ib$$
$$\left(\frac{(1-b)+ia}{(1+b)-ia}\right)^n = a+ib$$
$$\frac{(1-b)+ia}{(1+b)-ia}.\frac{(1+b)+ia}{(1+b)+ia} = \frac{1-b^2+2ia-a^2}{1+2b+b^2+a^2}$$
then 
$$\left(\frac{1-b^2-a^2}{1+2b+b^2+a^2}+\frac{2ia}{1+2b+b^2+a^2}\right)^n = a+ib$$
where
$$a=0  \text{; & } 1+2b+b^2\neq0$$
 [/INST] Set
$$
w=\frac{1+iz}{1-iz}
$$
so you can solve for $z$, getting
$$
z=i\frac{1-w}{1+w}
$$
This is real if and only if
$$
i\frac{1-w}{1+w}=-i\frac{1-\bar{w}}{1+\bar{w}}
$$
that becomes
$$
1+\bar{w}-w-w\bar{w}=-1+\bar{w}-w+w\bar{w}
$$
that is, $w\bar{w}=1$.
Therefore $|a+bi|=1$ is a necessary condition. Now if we write $a+bi$, the equation becomes
$$
\frac{1+iz}{1-iz}=u
$$
where $u$ is any $n$-th root of $a+bi$ and $|u|=1$. By the same argument as before, the solution is real.
</s>