Example $\mathbf{4}$ Let $f: \mathbf{R} \rightarrow \mathbf{R}$ satisfy
$$
f\left(f^{2}(x)+f(y)\right)=x f(x)+y \text {. }
$$

Find the analytical expression of the function $f(x)$.
(2012, Kyrgyzstan Mathematical Olympiad)
【Analysis】Consider using the "0" assignment method to eliminate $f(x)$, and the discussion of the indeterminate value of $f(0)$ is precisely the entry point of this problem.
Let $x=y=0, f(0)=s$.
Then $f\left(s^{2}+s\right)=0$.
Now let $x=s^{2}+s$.
Then $f(f(y))=y$.
If there exist $y_{1} \neq y_{2}$ such that $f\left(y_{1}\right)=f\left(y_{2}\right)$, then
$$
0=f\left(f\left(y_{1}\right)\right)-f\left(f\left(y_{2}\right)\right)=y_{1}-y_{2} \neq 0 \text {, }
$$

which is a contradiction. Hence, $f$ is injective.
Therefore, in equation (1), let $y=0$, then
$$
f(f(0))=f(s)=0 \text {. }
$$

Since $f$ is injective and $f\left(s^{2}+s\right)=0$, we have
$$
s^{2}+s=s \text {. }
$$

Thus, $s=0, f(0)=0$.
In the original equation, let $y=0$, we get
$$
f\left(f^{2}(x)\right)=x f(x) \text {. }
$$

The original equation is complex, and we can perform the "substitution" of equation (1) and equation (2). In equation (2), replace $x$ with $f(x)$.
$$
\begin{aligned}
\text { Then } f\left(x^{2}\right)=f(x) f(f(x)) \\
=x f(x)=f\left(f^{2}(x)\right) .
\end{aligned}
$$

Since $f$ is injective, we have $f^{2}(x)=x^{2}$.
Therefore, $f(x)=x$ or $f(x)=-x$.
If for some $x$, $f(x)=x$, and for some other $x$, $f(x)=-x$, then in the original equation, let $x$ satisfy $f(x)=x$ and $y$ satisfy $f(y)=y$, then $f\left(x^{2}+y\right)=y-x^{2}$, neither $f\left(x^{2}+y\right)=x^{2}+y$ nor $f\left(x^{2}+y\right)=-x^{2}-y$ can equal the right side, which is a contradiction.
Therefore, for all real numbers $x$,
$$
f(x)=x \text { or } f(x)=-x \text {. }
$$