<s>[INST] 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)$$
 [/INST] Note that
$$\begin{split}
\sum_{k=0}^{2n}x^k
&= \frac{x^{2n+1}-1}{x-1} \\
&= (2n+1)\int_0^1 (1-t + tx)^{2n}\mathrm{d}t \\
&= \frac{2n +1}{2^{2n+1}}
\int_{-1}^1(x+1 + (x-1)t)^{2n}\mathrm{d}t \\
&= \sum_{k=0}^{2n}\frac{_{2n}C_k(2n +1)}{2^{2n+1}}
\int_{-1}^1(x+1)^{2n-k}(x-1)^{k}t^k\mathrm{d}t \\
&= \sum_{k=0}^{n}\frac{_{2n}C_{2k}(2n+1)}{2^{2n}(2k+1)}
(x+1)^{2n-2k}(x-1)^{2k}\text{;}
\end{split}$$
whence
$$\boxed{\sum_{k=0}^{2n}x^k
=\sum_{k=0}^{n}\frac{_{2n}C_{2k}(2n+1)}{2^{2n}(2k+1)}
((x+1)^{n-k}(x-1)^{k})^2}\text{.}$$
Consequently, if $\frac{_{2n}C_{2k}(2n+1)}{2^{2n}(2k+1)}$ is a sum of squares (all nonnegative rationals are), then $\sum_{k=0}^{2n}x^k$ is a sum of squares with rational coefficients.
</s>