You have already determined the local maxima of a partial sum $S_n(x)$ in $[0,\pi]$ are at
$x_{n,m} = \frac{2m+1}{n+1} \pi$ for $m = 0,1, \ldots ,\lfloor\frac{n-1}{2} \rfloor$.
We first show that the vertical distance between successive peaks is diminishing in that
$$S_n\left(\frac{2m+1}{n+1}\pi \right) - S_n\left(\frac{2m+3}{n+1}\pi \right)> S_n\left(\frac{2m+3}{n+1}\pi \right) - S_n\left(\frac{2m+5}{n+1}\pi \right) > \ldots $$
Note that $\frac{2m+3}{n+1}\pi = \frac{2m+1}{n+1}\pi + \frac{2\pi}{n+1}$ and
$$S_n'\left(x\right) - S_n'\left(x+ \frac{2\pi}{n+1} \right) = \frac{\sin \frac{n}{2}x \cos \frac{n+1}{2}x}{\sin \frac{x}{2}} - \frac{\sin \left(\frac{n}{2}x+ \frac{n\pi}{n+1} \right) \cos \left(\frac{n+1}{2}x+\pi\right)}{\sin \left(\frac{x}{2}+ \frac{\pi}{n+1}\right)} \\ =\frac{\sin \frac{n}{2}x \cos \frac{n+1}{2}x}{\sin \frac{x}{2}} - \frac{\sin \left(\frac{n}{2}x- \frac{\pi}{n+1} \right) \cos \frac{n+1}{2}x}{\sin \left(\frac{x}{2}+ \frac{\pi}{n+1}\right)} \\ = \frac{\cos \frac{n+1}{2}x}{\sin \frac{x}{2}\sin \left(\frac{x}{2}+ \frac{\pi}{n+1}\right)}\left[\sin \frac{x}{2}\sin \left(\frac{n}{2}x+ \frac{\pi}{n+1}\right) -\sin \frac{x}{2}\sin \left(\frac{n}{2}x- \frac{\pi}{n+1}\right) \right]$$
Applying angle addition identities and simplifying we eventually get
$$\tag{1}S_n'\left(x\right) - S_n'\left(x+ \frac{2\pi}{n+1} \right) = \frac{\sin \frac{\pi}{n+1}\sin (n+1)x}{\cos \frac{\pi}{n+1} - \cos \left(\frac{\pi}{n+1} +x \right)}$$
Now consider the points
$$\frac{2m+1}{n+1}\pi \leqslant \frac{2m+2}{n+1}\pi-\frac{y}{n+1} \leqslant \frac{2m+2}{n+1} \leqslant \frac{2m+2}{n+1}\pi+\frac{y}{n+1} \leqslant \frac{2m+3}{n+1}\pi, \\ \frac{2m+3}{n+1}\pi \leqslant \frac{2m+4}{n+1}\pi-\frac{y}{n+1} \leqslant \frac{2m+4}{n+1} \leqslant \frac{2m+4}{n+1}\pi+\frac{y}{n+1} \leqslant \frac{2m+5}{n+1}\pi$$
Using (1) with $x_- = \frac{2m+2}{n+1}\pi-\frac{y}{n+1}$, $x'_-= x_- + \frac{2\pi}{n+1} = \frac{2m+4}{n+1}\pi-\frac{y}{n+1}$, $x_+ = \frac{2m+2}{n+1}\pi+\frac{y}{n+1}$, and$x'_+=x_+ + \frac{2\pi}{n+1} = \frac{2m+4}{n+1}\pi+\frac{y}{n+1}$we get
$$G'(y) = \frac{d}{dy} \left[S_n \left(x_-) - S_n \left(x'_-\right) \right] - S_n(x_+) - S_n(x'_+)\right] \\ = \frac{\sin \frac{\pi}{n+1} \sin y}{n+1}\left[\frac{1}{\cos \frac{\pi}{n+1}- \cos \left(\frac{(2m+3)\pi-y}{n+1}\right)} - \frac{1}{\cos \frac{\pi}{n+1}- \cos \left(\frac{(2m+3)\pi+y}{n+1}\right)} \right] $$
Notice that $G(0) = 0$ and $G'(y) > 0$ for $0 < y < \pi$, so $G(\pi) > 0$ which implies
$$S_n\left(\frac{2m+1}{n+1}\pi \right) - S_n\left(\frac{2m+3}{n+1}\pi \right)> S_n\left(\frac{2m+3}{n+1}\pi \right) - S_n\left(\frac{2m+5}{n+1}\pi \right)$$
When $m = \lfloor \frac{n-1}{2}\rfloor -1 $ we have $\frac{2m+3}{n+1} < \pi < \frac{2m+5}{n+1} = \pi + \delta$. Hence,
$$S_n\left(\frac{2m+5}{n+1}\pi \right) = S_n(\pi + \delta) = S_n(\pi + \delta - 2\pi) = S_n(\delta - \pi)= - S_n(\pi - \delta) < 0,$$
Since $\frac{2m+3}{n+1}$ is the last relative extremum point before $\pi$, $S_n(\pi) = 0$, and $\frac{2m+3}{n+1} < \pi - \delta < \pi$, it follows that
$$S_n\left(\frac{2m+3}{n+1}\pi \right) > 0 > S_n\left(\frac{2m+5}{n+1}\pi \right)$$
Thus, for all $m = 0,1,\ldots, \lfloor\frac{n-1}{2}\rfloor -1$ we have
$$S_n\left(\frac{2m+1}{n+1}\pi \right) - S_n\left(\frac{2m+3}{n+1}\pi \right) > 0$$
Thanks to Mr. metamorphy's answer. I rearrange the proof to make it suitable for my question.
Let $\omega =e^{2\pi pi/q}$
\begin{align}
(\omega-1)\sum_{n=1}^{q}n\omega^n&=(\omega-1)\left(\sum_{n=1}^{q}\omega^n+\sum_{n=2}^{q}\omega^n+\sum_{n=3}^{q}\omega^n+\cdots \sum_{n=q}^{q}\omega^n \right) \\
&=\omega(\omega^q-1)+\omega^2(\omega^{q-1}-1)+\omega^3(\omega^{q-2}-1)-1)+\cdots+\omega^q(\omega-1) \\
&=q\omega^{q+1}-\sum_{n=1}^{q}\omega^n=q\omega,\quad\text{since }\omega^q=1\text{ and }\sum_{n=1}^{q}\omega^n=0 \\
\sum_{n=1}^{q}\frac{n}{q}\omega^n&=\frac{\omega}{\omega-1},\quad\sum_{n=1}^{q}\frac{n}{q}\omega^{-n}=\frac{\omega^{-1}}{\omega^{-1}-1} \\
\sum_{n=1}^{q}\frac{2n}{q}\sin\left(\frac{2n\pi p}{q}\right)&=\sum_{n=1}^{q}\frac{2n}{q}\left(\frac{\omega^n-\omega^{-n}}{2i}\right)=\frac{1}{i}\left(\frac{\omega}{\omega-1}-\frac{\omega^{-1}}{\omega^{-1}-1}\right) \\
&=-\frac{1}{i}\left(\frac{1+\omega}{1-\omega}\right)=-\cot\left(\frac{\pi p}{q}\right) \\
\sum_{n=1}^{q}\frac{2n}{q}\cos\left(\frac{2n\pi p}{q}\right)&=\sum_{n=1}^{q}\frac{2n}{q}\left(\frac{\omega^n+\omega^{-n}}{2}\right)=\frac{\omega}{\omega-1}+\frac{\omega^{-1}}{\omega^{-1}-1} \\
&=\frac{\omega-1}{\omega-1}=1
\end{align}
Replace $q$ with $2q$,
$$
\sum_{n=1}^{2q}\frac{n}{q}\sin\left(\frac{n\pi p}{q}\right)=-\cot\left(\frac{\pi p}{2q}\right)=-\cot\left(\frac{\pi p}{q}\right)-\csc\left(\frac{\pi p}{q}\right)
$$
Best Answer
Let $\theta = \pi/n$. Inside each term of the sum, for $k = 1, 2, \ldots, 2n-1$, expand $\sin x$ to $\frac{1}{2i}\left(e^{ix} - e^{-ix}\right)$:
$$\begin{align*} \frac{\sin\frac{k^2 \pi}{2n}}{\sin\frac{k \pi}{2n}} &= \frac{\sin \frac{k^2\theta}{2}}{\sin \frac{k\theta}{2}}\\ &= \frac{e^{ik^2\theta/2} - e^{-ik^2\theta/2}}{e^{ik\theta/2} - e^{-ik\theta/2}}\\ &= \frac{e^{ik\theta/2}}{e^{ik^2\theta/2}}\cdot\frac{e^{ik^2\theta} - 1}{e^{ik\theta} - 1}\\ &= e^{-ik(k-1)\theta/2}\cdot\frac{\left(e^{ik\theta}\right)^k - 1}{e^{ik\theta} - 1}\\ &= \sum_{j=0}^{k-1} \left(e^{i\theta}\right)^{-k(k-1)/2 + jk} \end{align*}$$
The sequences of $-k(k-1)/2+jk$, when arranging the terms in a triangle, are: (up to $k=7 = 2\cdot 4-1$)
$$\require{cancel} \begin{array}{lccccccccccccccc} k=1, &&&&&&&&0\\ k=2, &&&&&&&-1&&1&\\ k=3, &&&&&\rightarrow&-3&\rightarrow&0&\rightarrow&3&\downarrow\\ k=4, &&&&&-6&&-2&&2&&6\\ k=5, &&&&-10&\uparrow&-5&&0&&5&\downarrow&10\\ k=6, &&&-15&&-9&&-3&&3&&9&&15\\ k=7, &\Rightarrow&-21&\Rightarrow&-14&\rlap\Rightarrow\uparrow&-7&\Rightarrow&0 &\Rightarrow&7&\rlap\Rightarrow\downarrow&14&\Rightarrow&21&\Downarrow\\ &\Uparrow&&&&\uparrow&&&&&&\downarrow&&&&\Downarrow\\ \hline &&&&&&&&&\llap{(\text{The non-existent $k=2n$ row:}}&&\cancel{3n}&&&&\cancel{7n})\\ \end{array}$$
Note that there are $n$ "paths" that each goes through the terms in:
(Two example paths for $n=4$ are given above, one in $\Uparrow\Rightarrow\Downarrow$ and one in $\uparrow\rightarrow\downarrow$.)
Each path has $2n-1$ terms, and the terms are in arithmetic progression. Different paths don't go through the same term, and all $n$ paths collectively cover the whole triangle.
For each path, when taking the terms to the $e^{i\theta}$th power, then adding all $2n-1$ complex exponentials together, this becomes a geometric series which equals $1$. Because if continuing the path by one term onto the non-existent $k=2n$ row, this geometric series of $2n$ complex exponentials becomes $0$. But that next exponent of $e^{i\theta}$ would be an odd multiple of $n$, so that extra complex exponential is $-1$.
Adding the $n$ geometric series together give the $n$ on the RHS. $\blacksquare$
By induction
Let $S(a)$ be the statement that
$$\sum_{k=1}^{2a-1} \sum_{j=0}^{k-1} \left(e^{i\theta}\right)^{-k(k-1)/2 + jk} = \sum_{p=1}^{a} \sum_{t=-(a-1)}^{a-1} \left(e^{i\theta}\right)^{t(2p-1)}$$
for $a \in \mathbb N$. The idea is that:
For $a=1$,
$$\begin{align*} LHS &= \sum_{k=1}^{1} \sum_{j=0}^{k-1} \left(e^{i\theta}\right)^{-k(k-1)/2 + jk}\\ &= \left(e^{i\theta}\right)^{-1(1-1)/2 + 0\cdot1}\\ &= \left(e^{i\theta}\right)^{0}\\ &= \sum_{p=1}^{1} \sum_{t=0}^{0} \left(e^{i\theta}\right)^{t(2p-1)} = RHS \end{align*}$$
Assume that $S(b)$ is true for some $a=b$, $b\in\mathbb N$.
For $a=b+1$,
$$\begin{align*} LHS &= \sum_{k=1}^{2b+1} \sum_{j=0}^{k-1} \left(e^{i\theta}\right)^{-k(k-1)/2 + jk}\\ &= \sum_{k=1}^{2b-1} \sum_{j=0}^{k-1} \left(e^{i\theta}\right)^{-k(k-1)/2 + jk} + \sum_{j=0}^{2b-1} \left(e^{i\theta}\right)^{-2b(2b-1)/2 + j2b} + \sum_{j=0}^{2b} \left(e^{i\theta}\right)^{-(2b+1)2b/2 + j(2b+1)}\\ &= \sum_{p=1}^{b} \sum_{t=-(b-1)}^{b-1} \left(e^{i\theta}\right)^{t(2p-1)} + \sum_{j=0}^{2b-1} \left(e^{i\theta}\right)^{b(2j-2b+1)} + \sum_{j=0}^{2b} \left(e^{i\theta}\right)^{(j-b)(2b+1)}\\ &= \sum_{p=1}^{b} \sum_{t=-(b-1)}^{b-1} \left(e^{i\theta}\right)^{t(2p-1)} + \sum_{j=0}^{b-1} \left(e^{i\theta}\right)^{b(2j-2b+1)} + \sum_{j=b}^{2b-1} \left(e^{i\theta}\right)^{b(2j-2b+1)} + \sum_{j=0}^{2b} \left(e^{i\theta}\right)^{(j-b)(2b+1)}\\ &= \sum_{p=1}^{b} \sum_{t=-(b-1)}^{b-1} \left(e^{i\theta}\right)^{t(2p-1)} + \sum_{p=1}^{b} \overbrace{\left(e^{i\theta}\right)^{b[2(-p)+1]}}^{\text{Replaced $j-b\to -p$}} + \sum_{p=1}^{b} \overbrace{\left(e^{i\theta}\right)^{b[2(p-1)+1]}}^{\text{Replaced $j-b\to p-1$}} + \sum_{t=-b}^{b} \overbrace{\left(e^{i\theta}\right)^{t(2b+1)}}^{\text{Replaced $j-b\to t$}}\\ &= \sum_{p=1}^{b} \sum_{t=-(b-1)}^{b-1} \left(e^{i\theta}\right)^{t(2p-1)} + \sum_{p=1}^{b} \left(e^{i\theta}\right)^{-b(2p-1)} + \sum_{p=1}^{b} \left(e^{i\theta}\right)^{b(2p-1)} + \sum_{t=-b}^{b} \left(e^{i\theta}\right)^{t[2(b+1)-1]}\\ &= \sum_{p=1}^{b} \sum_{t=-b}^{b} \left(e^{i\theta}\right)^{t(2p-1)} + \sum_{t=-b}^{b} \left(e^{i\theta}\right)^{t[2(b+1)-1]}\\ &= \sum_{p=1}^{b+1} \sum_{t=-b}^{b} \left(e^{i\theta}\right)^{t(2p-1)}\\ &= RHS \end{align*}$$
By induction, $S(a)$ is true for all $a\in\mathbb N$, and in particular for $a=n$. Then back to the question,
$$\begin{align*} LHS = \sum_{k=1}^{2n-1} \frac{\sin\frac{k^2 \pi}{2n}}{\sin\frac{k \pi}{2n}} &= \sum_{k=1}^{2n-1} \sum_{j=0}^{k-1} \left(e^{i\theta}\right)^{-k(k-1)/2 + jk}\\ &= \sum_{p=1}^{n} \sum_{t=-(n-1)}^{n-1} \left(e^{i\theta}\right)^{t(2p-1)}\\ &= \sum_{p=1}^{n} \left(e^{i(2p-1)\theta}\right)^{-(n-1)} \frac{\left(e^{i(2p-1)\theta}\right)^{2n-1}-1}{e^{i(2p-1)\theta}-1}\\ &= \sum_{p=1}^{n} \left(e^{i(2p-1)\theta}\right)^{-n} \frac{\left(e^{i(2p-1)\theta}\right)^{2n}- e^{i(2p-1)\theta}}{e^{i(2p-1)\theta}-1}\\ &= \sum_{p=1}^{n} e^{-i(2p-1)\pi}\frac{e^{i(2p-1)2\pi}- e^{i(2p-1)\pi/n}}{e^{i(2p-1)\pi/n}-1}\\ &= \sum_{p=1}^{n} (-1)\frac{1- e^{i(2p-1)\pi/n}}{e^{i(2p-1)\pi/n}-1}\\ &= \sum_{p=1}^{n} 1\\ &= n = RHS\quad \blacksquare \end{align*}$$