Example 4 For a prime $p \geq 5$ and a positive integer $n$, find all functions $f: \mathbf{Z}_{+} \rightarrow \mathbf{N}$, such that:
(1) For all integer sequences satisfying $a_{i} \notin\{0,1\}(1 \leqslant i \leqslant p-2)$, and $p \nmid\left(a_{i}-1\right)$, we have
$$
\sum_{i=1}^{p-2} f\left(a_{i}\right)=f\left(\prod_{i=1}^{p-2} a_{i}\right) ;
$$
(2) For any coprime integers $a, b$, when $a \equiv b(\bmod p)$, $f(a)=f(b)$;
(3) For any positive integer $n$, there exists $l \in \mathbf{Z}_{+}$, such that $f(l)=n$.
【Analysis】Let $a_{i}=-1$, at this time,
$$
(p-2) f(-1)=f(-1) \Rightarrow f(-1)=0 \text {. }
$$

Let $a_{i}=i+1$, according to Wilson's Theorem and combining with condition
(2) we have
$$
\sum_{i=2}^{p-1} f(i)=f\left(\prod_{i=2}^{p-1} i\right)=f(-1)=0 .
$$

By the problem, we know the range of the function is non-negative integers, hence
$$
f(i)=0(2 \leqslant i \leqslant p-1) \text {. }
$$

Let $a_{1}=4$, the rest $a_{i}=2$, by Fermat's Little Theorem we get
$$
\sum_{i=1}^{p-2} f\left(a_{i}\right)=f\left(2^{p-1}\right)=f(1)=0 \text {. }
$$

When $(a, p)=1$, $(a, a+k p)=1$.
Combining with condition (2), we get $f(n)=0$ (when $p \nmid n$).
At this point, all positive integers coprime with $p$ have been discussed.
Next, we discuss the case when $p \mid n$.
Let $a_{1}=x, a_{2}=y(x y \equiv-1(\bmod p)), a_{3}=$ $a_{4}=p$, the rest $a_{i}=-1$, we know
$$
2 f(p)=f\left(p^{2}\right) \text {. }
$$

By simple induction, we get
$$
f\left(p^{k}\right)=k f(p)(k \in \mathbf{N}) \text {. }
$$

For any integer $r$ coprime with $p$:
If $p \nmid(r-1)$, let $a_{1}=r, a_{2}=p^{k-1}, a_{3}=p$, the rest $a_{i}=-1$, we have
$$
f\left(r p^{k}\right)=\sum_{i=1}^{p-2} a_{i}=k f(p) ;
$$

If $p \mid(r-1)$, assume $r=m p+1$, we cannot directly substitute $r$, but after proving the above case, we can do some processing. Let
$$
\begin{array}{l}
a_{1}=(m p+1) p^{k}, a_{2}=(m p-1) p^{k}, \\
a_{3}=x, a_{4}=y(x y \equiv-1(\bmod p)),
\end{array}
$$

the rest $a_{i}=-1$, then
$$
\begin{array}{l}
f\left((m p+1) p^{k}\right) \\
=f\left(\left(m^{2} p^{2}-1\right) p^{2 k}\right)-f\left((m p-1) p^{k}\right) \\
=k f(p) .
\end{array}
$$

Organizing, we get $f(n)=\alpha v_{p}(n)(\alpha=f(p))$.
Combining with condition (3), we know
$$
f(p)|f(l) \Rightarrow f(p)| n \text {. }
$$

Thus, we finally get $f(n)=\alpha v_{p}(n)$, where $\alpha$ is a factor of $n$.