Decomposing $\sum_{i = 0}^{2n} x^i$ as a simple sum of squares As we have $\sum_{i = 0}^{2n} x^i = (x^{2n + 1} - 1) / (x - 1)$, the polynomial is positive.
So we know that there is a decomposition as a sum of squares. Is there a closed simple form for such a decomposition? For small value of $n$ we have
$$ x^2 + x + 1 = 1/4 ((2x+1)^2+ 3)$$
$$ x^4 + x^3 + x^2 + x + 1 = 1/16((4 x^2 + 2 x + 1)^2 + (2 x + 3)^2 + 6)$$
$$ x^6 + x^5 + x^4 + x^3 + x^2 + x + 1 = 1/144 ((12x^3+6x^2+4x+3)^2+ 3(2x^2+2x+5)^2 + 5(2x+3)^2 +15)$$

Let $\,\omega\,$ be a primitive $\,(2n+1)^{th}\,$ root of unity, so $\,\omega^{2n+1}=1\,$ and $\,\omega^{2n+1-k} = \dfrac{1}{\omega^k}=\overline{\omega^k}\,$. Then:
$$
P(x)=\sum_{k=0}^{2n} x^k = \prod_{k=1}^{2n}(x-\omega^k) = \prod_{k=1}^n\big((x-\omega^k)(x-\overline{\omega^k})\big) = \underbrace{\prod_{k=1}^n(x-\omega^k)}_{Q(x)} \;\underbrace{\prod_{k=1}^n(x-\overline{\omega^k})}_{\overline{\,Q\,}(x)}
$$
$Q\,$ is a polynomial with complex coefficients which can be written as $\,Q(x)=U(x) + i V(x)\,$ where $\,U,V\,$ are polynomials with real coefficients. It follows that:
$$
P(x) = Q(x) \, \overline{Q}(x)=\big(U(x)+i V(x)\big)\big(U(x)-i V(x)\big)=U^2(x) + V^2(x)
$$

[ EDIT ] $\;$ The above proves that $\,P(x)\,$ can always be written as the sum of just $\,2\,$ squares, and gives an explicit form for the two polynomials. However, $\,U(x)\,$ and $\,V(x)\,$ will generally not have rational coefficients, and can be laborious to calculate. A couple of examples below.

*

*$n=1:\;$ then $\,\omega = e^{i\,2\pi/3}=\frac{-1 + i\sqrt{3}}{2}\,$ and $\,Q(x) = \underbrace{\frac{2x+1}{2}}_{\, U(x)} + i \cdot \underbrace{\frac{-\sqrt{3}}{2}}_{\,V(x)}\,$, so:

$$
P(x)=U^2(x)+V^2(x) \quad\iff\quad x^2+x+1 =\frac{1}{4}\big((2x+1)^2 + 3\big) 
$$

*

*$n=2:\;$ then $\,\omega = e^{i\,2\pi/5}=\frac{1}{4} (\sqrt{5} - 1) + i \sqrt{\frac{1}{8}\left(5 + \sqrt{5}\right)}\;$ and:

$$
Q(x)=\frac{1}{4} (4 x^2 + 2 x - \sqrt{5} - 1) - \frac{1}{4} i \sqrt{\frac{5 + \sqrt{5}}{2}} \left(\left(\sqrt{5} + 1\right) x + \sqrt{5} - 1\right)
$$
    so:
$$
x^4+x^3+x^2+x+1 = \frac{1}{16}(4 x^2 + 2 x - \sqrt{5} - 1)^2 + \frac{5 + \sqrt{5}}{32} \left((\sqrt{5} + 1)x + \sqrt{5} - 1\right)^2
$$
