Example 5 Let $f: \mathbf{R} \rightarrow \mathbf{R}$ satisfy for any real numbers $x$, $y$,
$$
f(x+f(x+y))+f(x y)=x+f(x+y)+y f(x) \text {. }
$$

Find the analytical expression of the function $f(x)$. [2]
(56th IMO)
Let $x=y=0$. Then $f(f(0))=0$.
Let $f(0)=s, x=0, y=s$. Then
$2 s=s^{2} \Rightarrow s_{1}=2, s_{2}=0$.
This gives us the points for case analysis.
(1) When $s=2$, let $x=0, x=-y$, we get
$f(f(y))=f(y)+2 y-2$,
$f(x+2)+f\left(-x^{2}\right)=x+2-x f(x)$.
Let $x=-1$ in equation (2), then $f(1)=1$.
Let $y=1$ in the original equation, we get
$$
f(x+f(x+1))=x+f(x+1) \text {. }
$$

Inspired by the "fixed point" form in equation (3), let
$$
\begin{array}{l}
y=x+f(x+1) . \\
\text { Hence } f(f(y))=f(f(x)+f(x+1)) \\
=f(x+f(x+1))=f(y) \\
\Rightarrow 2 y-2=0 \\
\Leftrightarrow x+f(x+1)=1 \Leftrightarrow f(x)=2-x .
\end{array}
$$
(2) When $s=0$, $f(0)=0$ has a "cancellation" effect.
Let $x=0, y=0$, we get
$f(f(y))=f(y)$,
$$
f(x+f(x))=x+f(x) \text {. }
$$

Both have a form similar to a "fixed point". However, there is no obvious breakthrough when looking at each equation separately. Instead, let $x=f(y)$ in the above two equations, then
$$
f(2 f(y))=2 f(y) \text {. }
$$

Let $x=-1, y=1$, we get $f(-1)=-1$.
By symmetry, let $x=1, y=-1$, we get $f(1)=1$.
Let $x=1$, to simplify $f(x+y)$ in the original equation, replace $y$ with $y-1$, turning it into $f(y)$, then
$$
f(f(y)+1)+f(y-1)=f(y)+y .
$$

To create an equation around $f(f(y)+1)$, combine the "reduction" function of equation (4), let $x=1$, replace $y$ with $f(y)-1$, then
$$
f(f(y)+1)+f(f(y)-1)=2 f(y) \text {. }
$$

Let $x=-1$, replace $y$ with $y+1$, we get
$$
f(f(y)-1)+f(-y-1)=f(y)-y-2 \text {. }
$$

From equations (7) and (9), we get $f(f(y)+1)$ and $f(f(y)-1)$.
By (9) - ( (8) - (7)), we have
$$
f(y-1)=-f(-y-1)-2 \text {. }
$$

To simplify one of the expressions $f(y-1)$ or $f(-y-1)$, the above equation can be simplified to
$$
f(y-2)=-f(-y)-2 \text {. }
$$

The best use of this equation is to simplify the $f(x+y)$ part in the original equation by letting $x=-2$ or $y=-2$.

Since $x$ involves a wider range, in the original equation, let $x=-2$, and according to equation @, let $y=0$ to find $f(-2)=-2$, then
$$
f(f(y-2)-2)+f(-2 y)=f(y-2)-2-2 y \text {. }
$$

Using equation (10) twice to simplify $f(f(y-2)-2)$, then
$$
-f(f(-y)+2)+f(-2 y)=-f(-y)-2-2 y \text {. }
$$

Noticing that $y$ appears in the form of $-y$ here, replace $y$ with $-y$, then
$$
f(f(y)+2)+2 y=f(2 y)+f(y)+2 \text {. (11) }
$$

Replace $y$ with $f(y)$ and combine $f(f(y))=f(y)$, we get
$$
f(f(y)+2)+2 f(y)=f(2 f(y))+f(y)+2 \text {. (12) }
$$

In conjunction with equation (6), we get
$f(f(y)+2)=f(y)+2$.
Substitute into equation (11), we have
$$
f(y)+2+2 y=f(2 y)+f(y)+2,
$$

Thus, for any real number $y$, $f(2 y)=2 y$.
Simplifying, we get for any real number $x$, $f(x)=x$.
Upon verification, $f(x)=x$ or $f(x)=2-x(x \in \mathbf{R})$.
Assigning values to eliminate terms focuses on handling non-iterative functions, while iterative elimination focuses on handling iterative functions. For many functional equation problems, whether they "show their form externally" or "hide their momentum internally", they all require the method of assigning values using the domain and range of the function. Appropriate assignment of values is the key to opening up ideas and solving problems.