Here, we will prove the equation by @AndreNicolas and @Blue in a more elementary manner.
$$ 1+4\cos \left(\frac{2\pi}{7}\right)-4\cos^2 \left(\frac{2\pi}{7}\right)-8\cos^3 \left(\frac{2\pi}{7}\right) = 0 $$
Note that since $\cos 3x=4\cos^3 x-3\cos x$, and since $\cos 2x=2\cos^2 x-1$, our equation simplifies to $$ \cos \left(\frac{\pi}{7}\right) -\cos \left(\frac{2\pi}{7}\right) + \cos \left(\frac{3\pi}{7}\right) = \frac{1}{2}$$
Let $x=\frac{\pi}{7}$.
$$\cos x - \cos 2x + \cos 3x = \frac{1}{2}$$
$$\cos x + \cos 3x + \cos 5x = \frac{1}{2}$$
$$\cos x + \cos 3x + \cos 5x + ... = \frac{{\sin 2nx}}{{2\sin x}}$$
Since $n = 3$
$$\cos x + \cos 3x + \cos 5x = \frac{{\sin 6x}}{{2\sin x}}$$
$$\frac{{\sin 6x}}{{2\sin x}} = \frac{1}{2} \Leftrightarrow \sin 6x = \sin x$$
Which is true since $\sin (\pi-x)=\sin x$.
Or,similarly if $$K=\cos x - \cos 2x + \cos 3x $$ then $$K\sin\frac{\pi}{7}=\frac{\sin\frac{2\pi}{7}}{2}+\frac{\sin\frac{4\pi}{7}-\sin\frac{2\pi}{7}}{2}+\frac{\sin\frac{6\pi}{7}-\sin\frac{4\pi}{7}}{2}=\frac{\sin\frac{6\pi}{7}}{2}\implies K=\frac{1}{2}$$
Since $ 2\sin A\cos B=\sin(A+B)+\sin(A-B)$