I have difficulties understanding how this expression $$w=\frac{(1+i)z-i+1}{iz-1}$$
is simplified to this $$w=1-i-2\cdot\frac{1+i}{z+i}$$
Here are some steps from my exercise notebook: $$\frac{1+i}{i}=1-i$$
I understand why is this done, it's what stands in numerator with $z$ over what stands with $z$ in denominator. $$w=\frac{(1+i)z\color{green}{-i+1}}{iz-1}=\frac{(1-i)(iz-1)\color{red}{+1-i}\color{green}{-i+1}}{iz-1}=1-i+\frac{2-2i}{iz-1}=\\=1-i+\frac{-2-2i}{z+i}$$
The only problem I have is this red marked expression. I don't know where that comes from, unlike green which is obvious from the first one.
Any help would be appreciated. I am not pro at math and I often have problems with simple things. Thank you very much!
The expression $1-i$ that you have in red is the difference $$ (1+i)z-(1-i)(iz-1)=z+iz-(iz-1+z+i)=1-i. $$ So what happened was insteading of writing $A\color{green}{-i+1}$, your exercist notebook wrote $B+1-i\color{green}{-i+1}$ where $$ A=(1+i)z,\quad B=(1-i)(iz-1),\quad\text{and, as we have just seen, } 1-i=A-B. $$