Example 8 Find the rational solutions of the equation
$$
x^{x+y}=(x+y)^{y}
$$
【Analysis】First, analyze several simple cases.
When $x=0$, $0^{y}=0=y^{y}$, it is only possible that $y=0$. Since $0^{0}$ is undefined, we have $x \neq 0$.

When $y=0$, $x^{x}=1 \Rightarrow x=1$, so $x=1, y=0$ is a solution.

Assume $x \neq 0, y \neq 0$ below. Let $z=\frac{y}{x}$. Then the original equation simplifies to
$$
\begin{array}{l}
x^{x+y}=x^{z(1+z)}=(x+y)^{y}=x^{x z}(1+z)^{x z} \\
\Rightarrow x=(1+z)^{z} .
\end{array}
$$

Suppose the rational number $x=\frac{m}{n}((m, n)=1, m, n \in \mathbf{Z}$, $n \geqslant 1), z=\frac{p}{q}((p, q)=1, p, q \in \mathbf{Z}, q \geqslant 1)$.
Substituting into the equation, we get $\left(\frac{m}{n}\right)^{q}=\left(\frac{p+q}{q}\right)^{p}$.
When $p \geqslant 1$, $m^{q} q^{p}=(p+q)^{p} n^{q}$.
By $(p, q)=1$, we have $(p+q, q)=1$, i.e., $q^{p} \mid n^{q}$;
By $(m, n)=1$, we have $n^{q} \mid q^{p}$.
Therefore, $n^{q}=q^{p}$.
Let the prime factorization of $q$ be $q=p_{1}^{\alpha_{1}} p_{2}^{\alpha_{2}} \cdots p_{k}^{\alpha_{k}}$.
By $(p, q)=1, n^{q}=q^{p}$, we know that the exponents of each prime factor in the prime factorization of $q$ are multiples of $q$, i.e., there exists a positive integer $Q$ such that $Q^{q}=q$, which is only possible if $q=1$, i.e., $n=1$. At this time,
$$
x=(1+z)^{z}, y=z(1+z)^{z}\left(z \in \mathbf{Z}_{+}\right) .
$$

Similarly, when $p \leqslant-1$,
$$
m^{q}(p+q)^{-p}=q^{-p} n^{q} \text {. }
$$

By $(p, q)=1$, we have $(p+q, q)=1$, i.e.,
$q^{-p} \mid m^{q}$;
By $(m, n)=1$, we have $m^{q} \mid q^{-p}$.
Therefore, $|m|^{q}=q^{-p}$.
Let the prime factorization of $q$ be $q=p_{1}^{\alpha_{1}} p_{2}^{\alpha_{2}} \cdots p_{k}^{\alpha_{k}}$.
By $(p, q)=1,|m|^{q}=q^{-p}$, we know that the exponents of each prime factor in the prime factorization of $q$ are multiples of $q$, i.e., there exists a positive integer $Q$ such that $Q^{q}=q$, which is only possible if $q=1$, i.e., $|m|=1$. At this time,
$$
x=(1+z)^{z}, y=z(1+z)^{2}(z \in \mathbf{Z}, z<-1) \text {. }
$$

In summary, the rational solutions to the original equation are
$$
x=(1+z)^{2}, y=z(1+z)^{z}(z \in \mathbf{Z}, z \neq-1) .
$$