Example 1. Find the value of $\cos \frac{\pi}{7}-\cos \frac{2 \pi}{7}+\cos \frac{3 \pi}{7}$ $-\cos \frac{4 \pi}{7}+\cos \frac{5 \pi}{7}-\cos \frac{6 \pi}{7}$.
Solve: In (1), let $\alpha=0, n=6$, and transform to get
$$
1+\sum_{k=1}^{0} \cos k \beta=\frac{\cos 3 \beta \sin \frac{7}{2} \beta}{\sin \frac{\beta}{2}} \text {. }
$$

Let $\beta=\pi-\frac{\pi}{7}, \cos k \beta=\cos k \left( \pi -\frac{\pi}{7}\right)=(-1)^{k} \cos \frac{k \pi}{7}$. Therefore,
$$
\begin{array}{l}
\sum_{k=1}^{\infty}(-1)^{k-1} \cos k \frac{\pi}{7} \\
=1-\frac{\cos 3\left(\pi-\frac{\pi}{7}\right) \sin \frac{7}{2}\left(\pi-\frac{\pi}{7}\right)}{\sin \frac{1}{2}\left(\pi-\frac{\pi}{7}\right)} \\
=1-0=1 .
\end{array}
$$