Suppose $N$ is a fixed natural number. We split the interval $[1,N]$ into $L-1$ parts, where $L$ is some natural number less than $N$. This gives us an ordered set of points $\{n_i\}_{i=1}^L$, where $n_1=1$, $n_{i+1}>n_i$ for $i \in \{1,\dots,L-1\}$, and $n_L=N$. Our goal is to maximize the sum
$$ S = \sum_{i=2}^L \left( 1 - \frac{n_{i-1}}{n_i}\right)^2. $$
In particular, I have found that if we choose $L=\left\lfloor \frac{\log N}{\log 2} \right\rfloor$ and $n_i=2^{i-1}$ for $i \in \{1,\dots,L-1\}$ and $n_L=N$, then there exists a constant $C$ such that $S \geq C \log N$. However, I am wondering if there exists a better bound.
Additionally, I would like to ask if there is any literature on optimizing sums over partitions of an integer interval.