* Given the quadratic equation in $x$: $a(1+\mathrm{i}) x^{2}+\left(1+a^{2} \mathrm{i}\right) x+a^{2}+\mathrm{i}=0$ has real roots, find the value of the real number $a$.
Suppose the original equation has a real root $x_{0}$, substituting into the original equation gives $a(1+\mathrm{i}) x_{0}^{2}+\left(1+a^{2} \mathrm{i}\right) x_{0}+a^{2}+\mathrm{i}=0$, which is $\left(a x_{0}^{2}+x_{0}+a^{2}\right)+\mathrm{i}\left(a x_{0}^{2}+a^{2} x_{0}+1\right)=0$. According to the necessary and sufficient condition for the equality of complex numbers, we have $\left\{\begin{array}{l}a x_{0}^{2}+x_{0}+a^{2}=0 \\ a x_{0}^{2}+a^{2} x_{0}+1=0,\end{array}\right.$ solving this gives $x_{0}=1$ or $a=\pm 1$.

When $x_{0}=1$, substituting into $a x_{0}^{2}+x_{0}+a^{2}=0$ gives $a^{2}+a+1=0$. Since $a \in \mathbf{R}, a^{2}+a+1=\left(a+\frac{1}{2}\right)^{2}+\frac{3}{4}>0$, so it does not hold. Similarly, when $a=+1$, it does not hold either. When $a=-1$, the equation becomes $x_{0}^{2}-x_{0}-1=0$, so $x_{0}=\frac{1 \pm \sqrt{5}}{2}$ satisfies the condition, hence $a=-1$.