I don't have the full question but I'm assuming $f(z)$ must be entire for this to occur. Also note that $u>1$ where $u$ is the real part of $f(z)$.
If we solve the given eqn then we are left with $v=0$. I have the $v=0$ drawn out on an axis. Now my professor has stated that we "rotate" this to the imaginary axis by multiplying it with $i$ so we somehow end up with $|e^{if(z)}|=1$. What's going on here?
$\Im(f^2(z) - f(z)) =0 $ gives that $2uv = v$. This means either $u=\frac{1}{2}$ or $v=0$. Now use Cauchy-Riemann equation to deduce that $f$ is constant