Example 8 Let the prime factorization of $m$ be $p_{1}^{q_{1}} \cdots p_{r}^{\sigma_{r}}$. Find the value of the sum
$$S(m)=\sum_{x \bmod m}^{\prime} \mathrm{e}^{2 \pi \mathrm{ix} / m}$$
where the summation $\sum_{x \bmod m}^{\prime}$ indicates the sum over any complete set of reduced residues modulo $m$.
Since for any integer $a, \mathrm{e}^{2 \times \mathrm{x} a}=1$, the value of the exponential sum (38) is independent of the specific choice of the reduced residue system. Let $\sum_{x \bmod m}$ denote the sum over any complete residue system modulo $m$. It is evident that for any integer $c$ we have
$$\sum_{x \bmod m} \mathrm{e}^{2 \mathrm{xi} \alpha / m}=\sum_{x=1}^{m} \mathrm{e}^{2 \mathrm{x} \mathrm{i} \alpha / m}=\left\{\begin{array}{ll}
m, & m \mid c \\
0, & m \nmid c
\end{array}\right.$$

By Theorem 15, if we take $m_{j}=p_{j}^{\circ}(1 \leqslant j \leqslant r), m_{j} M_{j}=m$, then when $x^{(j)}$ runs through the reduced residue system modulo $p_{j}^{a_{j}}$,
$$x=M_{1} x^{(1)}+\cdots+M_{r} x^{(r)}$$

runs through the reduced residue system modulo $m$. Therefore,
$$\begin{aligned}
S(m) & =\sum_{\left.x^{(1)}\right)_{\bmod m_{1}}}{ }^{\prime} \cdots \sum_{\left.x^{(r)}\right)_{\bmod m_{r}}} \mathrm{e}^{2 \pi i\left(M_{1} x^{(1)}+\cdots+M_{r} x^{(r)}\right) / m} \\
& \left.=S\left(p_{1}^{a_{1}}\right) S\left(p_{2}^{a}\right)_{2}\right) \cdots S\left(p_{r}^{\alpha}\right)
\end{aligned}$$

It is easy to see that
$$S\left(p_{j}^{\sigma_{j}}\right)=\sum_{x^{(j)}=1}^{p_{j}^{\sigma_{j}}} \exp \left\{\frac{2 \pi \mathrm{i} x^{(j)}}{p_{j}^{\varepsilon_{j}}}\right\}-\sum_{y^{(j)}=1}^{p_{j}^{\beta_{j}}-1} \exp \left\{\frac{2 \pi \mathrm{i} y^{(j)}}{p_{j}^{\alpha_{j}-1}}\right\}$$

From this and equation (39), we obtain
$$S\left(p_{j}^{\alpha_{j}}\right)=\left\{\begin{array}{ll}
-1, & \alpha_{j}=1 \\
0, & \alpha_{j}>1,
\end{array}\right.$$

Thus we get $\square$
$$S(m)=\left\{\begin{array}{ll}
(-1)^{r}, & \alpha_{1}=\cdots=\alpha_{r}=1, \\
0, & \text { otherwise. }
\end{array}\right.$$
$S(m)$ is the famous Möbius function in number theory, usually denoted by $\mu(m)$. In Chapter 8, Section 1.2, we will discuss it further. This example demonstrates the theoretical importance of studying the structure of residue systems.