Example 6 The general term formula of the sequence $\left\{f_{n}\right\}$ is
$$
f_{n}=\frac{1}{\sqrt{5}}\left[\left(\frac{1+\sqrt{5}}{2}\right)^{n}-\left(\frac{1-\sqrt{5}}{2}\right)^{n}\right]\left(n \in \mathbf{Z}_{+}\right) \text {. }
$$

Let $S_{n}=\mathrm{C}_{n}^{1} f_{1}+\mathrm{C}_{n}^{2} f_{2}+\cdots+\mathrm{C}_{n}^{n} f_{n}$. Find all positive integers $n$ such that $S_{n}$ is divisible by 8.
$(2005$, Shanghai High School Mathematics Competition)
Let $\alpha=\frac{1+\sqrt{5}}{2}, \beta=\frac{1-\sqrt{5}}{2}$. Then
$$
\begin{array}{l}
S_{n}=\frac{1}{\sqrt{5}} \sum_{i=1}^{n} \mathrm{C}_{n}^{i}\left(\alpha^{i}-\beta^{i}\right) \\
=\frac{1}{\sqrt{5}} \sum_{i=0}^{n} \mathrm{C}_{n}^{i}\left(\alpha^{i}-\beta^{i}\right) \\
=\frac{1}{\sqrt{5}}\left(\sum_{i=0}^{n} \mathrm{C}_{n}^{i} \alpha^{i}-\sum_{i=0}^{n} \mathrm{C}_{n}^{i} \beta^{i}\right) \\
=\frac{1}{\sqrt{5}}\left[(1+\alpha)^{n}-(1+\beta)^{n}\right] \\
\quad=\frac{1}{\sqrt{5}}\left[\left(\frac{3+\sqrt{5}}{2}\right)^{n}-\left(\frac{3-\sqrt{5}}{2}\right)^{n}\right] .
\end{array}
$$

Notice that, $\frac{3+\sqrt{5}}{2} \times \frac{3-\sqrt{5}}{2}=1$. Therefore,
$$
\begin{array}{l}
S_{n+2}=\frac{1}{\sqrt{5}}\left\{\left[\left(\frac{3+\sqrt{5}}{2}\right)^{n+1}-\left(\frac{3-\sqrt{5}}{2}\right)^{n+1}\right] \cdot\right. \\
{\left[\left(\frac{3+\sqrt{5}}{2}\right)+\left(\frac{3-\sqrt{5}}{2}\right)\right]-} \\
\left.\left[\left(\frac{3+\sqrt{5}}{2}\right)^{n}-\left(\frac{3-\sqrt{5}}{2}\right)^{n}\right]\right\} \\
=3 S_{n+1}-S_{n} \text {. } \\
\end{array}
$$

Therefore, the remainder of $S_{n+2}$ when divided by 8 is completely determined by the remainders of $S_{n+1}$ and $S_{n}$ when divided by 8.
It is easy to see that, $S_{1}=\mathrm{C}_{1}^{1} f_{1}=1, S_{2}=\mathrm{C}_{2}^{1} f_{1}+\mathrm{C}_{2}^{2} f_{2}=3$.
Hence, from equation (1), the remainders of $\left\{S_{n}\right\}$ when divided by 8 are $1,3,0,5,7,0,1,3, \cdots$, which is a periodic sequence with a period of 6.
Thus, $8\left|S_{n} \Leftrightarrow 3\right| n$.