Example 4 Given a cube, color its surface, with each face being colored with only one color, and there are $m$ colors available. How many different ways are there to do this?
Let $N_{6}=\{1,2, \cdots, 6\}$, here, $1,2,3,4,5,6$ represent the top, bottom, and four side faces of a cube (Figure 1-13). Similarly, the permutation group $G=\left\{P_{1}, P_{2}, \cdots, P_{24}\right\}$ of $N_{6}$ is divided into 5 classes (Figure 1-12).

I. The permutation $P_{1}=I_{1}=(1)(2)(3)(4)(5)(6)$ that leaves the cube unchanged, so $C\left(P_{1}\right)=6$.

II. Rotating $\pm 90^{\circ}$ about the line connecting the centers of two opposite faces, there are 6 such permutations: $P_{2}, P_{3}, \cdots, P_{7}$. Each can be seen as the product of 2 one-cycle and 1 four-cycle. For example, $P_{2}=(1)(2)(3456)$, so $C\left(P_{i}\right)=3(i=2,3, \cdots, 7)$.

III. Rotating $180^{\circ}$ about the line connecting the centers of two opposite faces, there are 3 such permutations: $P_{8}, P_{9}, P_{10}$. Each can be seen as the product of 2 one-cycle and 2 two-cycle. For example, $P_{11}=(1)(2)(35)(46)$, so $C\left(P_{i}\right)=4(i=8,9,10)$.

IV. Rotating $\pm 120^{\circ}$ about a diagonal of the cube, there are 8 such permutations: $P_{11}, P_{12}, \cdots, P_{18}$. Each can be seen as the product of 2 three-cycle. For example, $P_{11}=(136)(254)$, so $C\left(P_{i}\right)=2(i=11,12, \cdots, 18)$.

V. Rotating $180^{\circ}$ about the line connecting the midpoints of a pair of opposite edges, there are 6 such permutations: $P_{19}, P_{20}, \cdots, P_{24}$. Each can be seen as the product of 3 two-cycle. For example, $P_{19}=(12)(34)(56)$, so $C\left(P_{i}\right)=3(i=19,20, \cdots, 24)$.

Thus, by Theorem (1), the number of different coloring methods is
$$
\begin{aligned}
M & =\frac{1}{|G|} \quad \sum_{i=1}^{24} m^{C\left(P_{i}\right)}=\frac{1}{24}\left(m^{6}+6 m^{3}+3 m^{4}+8 m^{2}+6 m^{3}\right) \\
& =\frac{1}{24} m^{2}\left(m^{4}+3 m^{2}+12 m+8\right) .
\end{aligned}
$$

Since the general Pólya counting theorem requires a lot of group theory knowledge to state, it is omitted here. The Pólya counting theorem is a major theorem in counting theory, and it has important applications in chemistry, genetics, and other sciences involving molecular structures. Additionally, it has wide applications in graph theory, coding theory, and computer science.