Note that we can express the sum $F(x_1,\cdots,x_n)=\sum (x_i^3 - x_i^2)$ in terms of elementary symmetric polynomials. Specifically,
$$ F=e_1^3-e_1^2+(2-3e_1)e_2+3e_3. $$
From the constraint we know that $e_1=S$. Therefore we just need to minimize
$$ (2-3S)e_2+3e_3. $$
If $S<2/3$, we want $e_2$ and $e_3$ as small as possible. Note that $e_2=e_3=0$ when all but one variable is $0$, that is,
$$ x_i=\begin{cases} S, & i=j,\\ 0, & i\neq j. \end{cases} $$
where $1\leq j\leq n$ can be any integer.
If $S=2/3$, we want $e_3=0$, which means at most two variables are non-zero. These two variables can take any non-negative values that satisfy $x_{j_1}+x_{j_2}=S$.
If $S>2/3$, we have a tradeoff between $e_2$ and $e_3$.
We observe that: $$ x^3 - x^2 + \frac{1}{4}x = x\left(x^2 - x + \frac{1}{4}\right) = x\left(x - \frac{1}{2}\right)^2 \ge 0, $$
thus, for all $x\ge 0$: $$ x^3 - x^2 \ge -\frac{1}{4}x, $$ where equality is reached when $x=0$ or $x=1/2$.
Summing over all $i$: $$ F = \sum (x_i^3 - x_i^2) \ge -\frac{1}{4} \sum x_i = -\frac{S}{4}. $$
When $S$ is a multiple of $1/2$ and $S\le n/2$ we can set $2S$ variables to $1/2$ and the others to $0$.

(The red curve is $f(x) = x^3-x^2+x/4$ and the blue line is its derivative.)
Otherwise, if $S \ge n/2$, assigning $x_i = 1/2$ to all $n$ variables is insufficient, leaving leftover $r = S - n/2 > 0$. The sum $\sum f(x_i)$ is minimized when all variables are equal (“spreading out” $r$ across all variables). The minimal value is then
$$ F = n f(S/n) - \frac{S}{4} = S \left(\frac{1}{2} - \frac{S}{n}\right)^2 - \frac{S}{4}. $$
If $S <n/2$, we can assign $x_i = 1/2$ to as many variables as possible, say $k = \lfloor 2S \rfloor$, and set the rest to zero. The remaining sum $r = S - k/2 \le 1/2$ needs to be distributed across variables. We only need to compare two strategies (I obtained this from the graph; might need to rigorously prove it later):
EDIT: This part is wrong. See the other answers for counterexample.
- Distribute $r$ across all variables with value $1/2$ to make them $1/2+r/k$.
- Put all of $r$ into one variable with value $0$ to make it $r$.
The minimum values are:
$$ F_A = kf(1/2 + r/k) -\frac{S}{4}=r^2\left(\frac{1}{2k}+\frac{r}{k^2}\right) -\frac{S}{4} $$
and
$$ F_B=f(r) -\frac{S}{4}=\frac{r}{4}-r^2+r^3 -\frac{S}{4}. $$
$F_A \le F_B$ iff $r\le r_k$ where
$$ r_k=\frac{k\big(2k-\sqrt{4k+5}+1\big)}{4(k^2-1)}\qquad (k\ge2). $$