9. (This question is worth 16 points) Given the complex number $z$, such that $z_{1}=\frac{z}{1+z^{2}}$ and $z_{2}=\frac{z^{2}}{1+z}$ are both real numbers, find $z_{\text {。 }}$.

---

The translation is provided as requested, maintaining the original formatting and structure.
Solution: Given that $z_{1}=\frac{z}{1+z^{2}}$ is a real number, then $z_{1}=z_{1}$, so $\frac{z}{1+z^{2}}=\frac{z}{1+z^{2}}$, which simplifies to $z(1+z^{2})=z(1+\bar{z}^{2})$. Rearranging gives $(z-\bar{z})(z \bar{z}-1)=0$. Since $z$ is an imaginary number, we have $z \bar{z}=1, \cdots \cdots 8$ points. Similarly, for $z_{2}=\frac{z^{2}}{1+z}$ being a real number, we get $z+\bar{z}+z \bar{z}=0$. Substituting $z \bar{z}=1$ into the equation and simplifying yields $z^{2}+z+1=0$, so $z=-\frac{1}{2} \pm \frac{\sqrt{3}}{2} i_{0} \cdots \cdots 16$ points.