How did they simplify this expression involving roots of unity? Suppose $\omega$ is a primitive seventh root of unity.  I would like to find as simple an expression as possible for $$ \sum_{j=0}^6 (1 + \omega^j)^n. $$
The book I am looking at gives 
$$ 2^n \left\lfloor 1+2\sum_{j=1}^3 \cos{\frac{\pi j n}{7}} \cos^n \frac{ \pi j}{j} \right\rfloor $$
with no explanation, and I am wondering how they got this.  (I am also wondering if it is a typo, since this book seems to have quite a few --- if it is correct as written, why not cancel the rightmost $j$'s and rewrite $\cos^n \pi$ as $(-1)^n$?)
Added:
Motivation: this is the last step in simplifying the expression $$\sum_{k=0}^{\lfloor n / 7 \rfloor} {n \choose 7k}.$$ This is problem #42(f) in section 1 of Lovasz's Combinatorial Problems and Exercises, Second Edition.  In my copy, the problem is on p. 21, and the solution (which makes sense until the last step) is on p. 195.
(To be clear, I have pulled out a factor of $\frac{1}{7}$ which appears somewhere along the way but is irrelevant to the above.)  
 A: Using $1+e^{2\pi i/7\;j}=2\cos\left(\pi/7\;j\right)e^{\pi i/7\;j}$, we get
$$
\sum_{j=0}^6(1+\omega^j)^n=2^n\sum_{j=0}^6\cos^n\left(\frac{\pi j}{7}\right)e^{\pi i/7\;nj}\tag{1}
$$
Noting that each term in the sum can be paired with its conjugate, we see that the sum is real.  Therefore, we can simply take the real part of $(1)$, which yields
$$
\sum_{j=0}^6(1+\omega^j)^n=2^n\sum_{j=0}^6\cos^n\left(\frac{\pi j}{7}\right)\cos\left(\frac{\pi nj}{7}\right)\tag{2}
$$
Using that $\cos^n\left(\frac{\pi(7-j)}{7}\right)=(-1)^n\cos^n\left(\frac{\pi j}{7}\right)$ and $\cos\left(\frac{\pi n(7-j)}{7}\right)=(-1)^n\cos\left(\frac{\pi nj}{7}\right)$ and $\cos(0)=1$, $(2)$ becomes
$$
\sum_{j=0}^6(1+\omega^j)^n=2^n\left[1+2\sum_{j=1}^3\cos^n\left(\frac{\pi j}{7}\right)\cos\left(\frac{\pi nj}{7}\right)\right]\tag{3}
$$
A: I think this is rather less mysterious than it looks and just resulted from a combination of two misprints. The floor function should be a bracket, and the $j$ in the denominator should be a $7$. Then the derivation is straightforward:
$$
\begin{align}
\sum_{j=0}^6 \left(1 + \omega^j\right)^n
&=
\sum_{j=0}^6 \left(1 + \mathrm e^{2\pi\mathrm ij/7}\right)^n
\\
&=
\sum_{j=0}^6 \left(\mathrm e^{\pi\mathrm ij/7}\left(\mathrm e^{\pi\mathrm ij/7}+\mathrm e^{-\pi\mathrm ij/7}\right)\right)^n
\\
&=
\sum_{j=0}^6 \mathrm e^{\pi\mathrm ijn/7}\left(2\cos\frac{\pi j}7\right)^n
\\
&=
2^n\sum_{j=0}^6 \mathrm e^{\pi\mathrm ijn/7}\cos^n\frac{\pi j}7
\\
&=
2^n\left(1+2\sum_{j=1}^3 \cos\frac{\pi jn}7\cos^n\frac{\pi j}7\right)\;.
\end{align}
$$
