The solutions described via the link http://winvector.github.io/freq/explicitSolution.html (posted in one of the earlier answers) can be given by the following formula: $$ x_i=\frac{(k-2i)\sqrt{k}+(2i-1)k}{2k(k-1)}=\frac{1}{2(1+\sqrt{k})}+\frac{i}{\sqrt{k}(1+\sqrt{k})}. $$ Note that (when $k$ is fixed): A. $x_i$ is an increasing function of $i$, and we have $$ x_0=\frac{1}{2(1+\sqrt{k})}, \quad x_k=\frac{1+2\sqrt{k}}{2+2\sqrt{k}}, $$ so all these numbers are between 0 and 1. B. Moreover, we have $x_i=a+bi$, so $S(p,x)$ can be represented as $$ -x_0^2+\sum_{i=0}^k\binom{k}{i}p^i(1-p)^{k-i}(U+Vi+Wi^2), $$ where $U$, $V$ and $W$ depend on $k$ and $p$ but not on $i$. It remains to use formulas \begin{gather} \sum_{i=0}^k\binom{k}{i}p^i(1-p)^{k-i}=1,\\ \sum_{i=0}^k i\binom{k}{i}p^i(1-p)^{k-i}=np,\\ \sum_{i=0}^k i(i-1)\binom{k}{i}p^i(1-p)^{k-i}=n(n-1)p^2 \end{gather} (which are obvious) to check directly that the formulas for $x_i$ as above give a solution.