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)$.
【Analysis】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
$$
\begin{array}{l}
f(f(y))=f(y)+2 y-2, \\
f(x+2)+f\left(-x^{2}\right)=x+2-x f(x) .
\end{array}
$$

In equation (2), let $x=-1$, then $f(1)=1$.
In the original equation, let $y=1$, we get
$$
f(x+f(x+1))=x+f(x+1) \text {. }
$$

Inspired by the "fixed point" form of equation (3), in equation (1), 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
$$
\begin{array}{l}
f(f(y))=f(y), \\
f(x+f(x))=x+f(x) .
\end{array}
$$

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

First, let $x=-1, y=1$, we get $f(-1)=-1$.
By symmetry, then let $x=1, y=-1$, we get $f(1)=1$.
Let $x=1$, to simplify the burden of $f(x+y)$ in the original equation, replace $y$ with $y-1$, it becomes $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 have
$$
f(f(y)-1)+f(-y-1)=f(y)-y-2 \text {. }
$$

From equations (7) to (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$.
To reduce the burden of one of the equations $f(y-1)$ and $f(-y-1)$, the above equation can be simplified to
$$
f(y-2)=-f(-y)-2 \text {. }
$$

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

Since the range of $x$ is broader, 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$. Using equation (10) twice to simplify $f(f(y-2)-2)$, then $-f(f(-y)+2)+f(-2 y)=-f(-y)-2-2 y$. Observing 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 {. (II) }
$$
Replace $y$ with $f(y)$ and combine $f(f(y))=f(y)$ to get $f(f(y)+2)+2 f(y)=f(2 f(y))+f(y)+2$. (12) In conjunction with the previous equation (6), we get
$$
f(f(y)+2)=f(y)+2 \text {. }
$$

Substitute into equation (11) to get
$$
f(y)+2+2 y=f(2 y)+f(y)+2 \text {, }
$$

That is, 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 are "manifested externally" or "hidden 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.
References:
[1] 2012 Singapore Mathematical Olympiad [J]. Translated by Lou Yapeng. Middle School Mathematics, 2013 (Supplement II).
[2] 56th IMO Problems [J]. Middle School Mathematics, 2015(8).