Why is $\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\sin^2\left((2k-1)\frac\pi n\right)=\frac n4$? I found the relation for $n\geq3$ $$\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\sin^2\left((2k-1)\frac\pi n\right)=\frac n4$$But despite my best efforts, I still have no idea as to how to prove it.
Things I've tried:

*

*Adding $\cos^2$ terms. Of course, $\sin^2x+\cos^2x$ and $\cos^2x-\sin^2x$ are both simplifiable, so I thought about adding $\cos^2$ terms to make the sum into $\frac n2$ and hope that the $\sin^2$ and $\cos^2$ terms sum to equal amounts. They don't in the $n$ odd case, so I didn't know what to do with this approach.

*Adding more $\sin^2$ terms: Since $\sin^2 x=\sin^2(\pi-x)$, we can add terms to this sum, but honestly, it didn't make the sum any easier to evaluate.

Any help here?
Edit:
Based on the comments, here are my attempts.
$$\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\sin^2\left((2k-1)\frac\pi n\right)=\frac12\cdot\left\lfloor\frac n2\right\rfloor-\frac12\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\cos\left((2k-1)\frac{2\pi}n\right)$$$$=\frac12\cdot\left\lfloor\frac n2\right\rfloor-\frac12\mathfrak{Re}\left(\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\exp\left((2k-1)\frac{2i\pi}n\right)\right)$$How do I finish?
 A: Let$$T=\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\cos\left((2k-1)\frac{2\pi} n\right)$$$$S=\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\sin^2\left((2k-1)\frac\pi n\right)$$
We can get the relation $T+2S=\lfloor\frac n2\rfloor$

If $n$ is even then using summation of cosines whose angles are in AP we get,
$$T=\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\cos\left((2k-1)\frac{2\pi} n\right)=\frac {\sin\lfloor\frac n2\rfloor\frac {2\pi}n}{\sin\frac {2\pi}n}\cos\bigg[\frac{2\pi}n+(\lfloor\frac n2\rfloor-1)\frac{2\pi}n\bigg]=0$$
$$\implies S=\frac n4$$

If $n$ is odd then let $n=2m+1$. We get,
$$\begin{align*}T=\sum\limits_{k=1}^{m}\cos\left((2k-1)\frac{2\pi} {2m+1}\right)&=\frac {\sin \frac {2\pi m}{2m+1}}{\sin\frac {2\pi}{2m+1}}\cos\bigg[\frac{2\pi}{2m+1}+(m-1)\frac{2\pi}{2m+1}\bigg]
\\&
\\&=\frac {\sin \frac {2\pi m}{2m+1}\cos \frac {2\pi m}{2m+1}}{\sin\frac {2\pi}{2m+1}}
\\&
\\&=\frac {\sin \frac {4\pi m}{2m+1}}{2\sin\frac {2\pi}{2m+1}}
\\&
\\&=\frac {-\sin \frac {2\pi }{2m+1}}{2\sin\frac {2\pi}{2m+1}}=\frac{-1}{2}\end{align*}$$
$$\implies S=\frac{2m+1}2=\frac n4$$
A: Following your way, by geometric series we have that for $n=2N$
$$\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\exp\left((2k-1)\frac{2i\pi}n\right)=\sum\limits_{k=1}^{N}\exp\left((2k-1)\frac{i\pi}N\right)=\\=e^{-\frac{i\pi }N}\sum\limits_{k=1}^{N}\left(e^{\frac{i2\pi}N}\right)^k=e^{-\frac{i\pi }N}\frac{e^{\frac{i2\pi}N}-e^{\frac{i2\pi(N+1)}N}}{1-e^{\frac{i2\pi}N}}=e^{\frac{i\pi }N}\frac{1-e^{i2\pi}}{1-e^{\frac{i2\pi}N}}=0$$
then
$$\frac12\cdot\left\lfloor\frac n2\right\rfloor-\frac12\mathfrak{Re}\left(\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\exp\left((2k-1)\frac{2i\pi}n\right)\right)=\frac12 N+0 = \frac n 4$$
For $n=2N+1$
$$\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\exp\left((2k-1)\frac{2i\pi}n\right)=\sum\limits_{k=1}^{N}\exp\left((2k-1)\frac{i\pi}{2N+1}\right)=\\
=e^{-\frac{i2\pi }{2N+1}}\sum\limits_{k=1}^{N}\left(e^{\frac{i4\pi}{2N+1}}\right)^k
=e^{-\frac{i2\pi }{2N+1}}\frac{e^{\frac{i4\pi}{2N+1}}-e^{\frac{i4\pi(N+1)}{2N+1}}}{1-e^{\frac{i4\pi}{2N+1}}}
=\frac{e^{\frac{i2\pi}{2N+1}}-1}{1-e^{\frac{i4\pi}{2N+1}}}=-\frac1{1+e^{\frac{i2\pi}{2N+1}}}$$
and we also have
$$w=-\frac1{1+e^{\frac{i2\pi}{2N+1}}} \implies w+\bar w=-1 \implies \Re(w)=-\frac12$$
indeed
$$w+\bar w=-\frac1{1+e^{\frac{i2\pi}{2N+1}}}-\frac1{1+e^{\frac{-i2\pi}{2N+1}}}=-\frac1{1+e^{\frac{i2\pi}{2N+1}}}-\frac{e^{\frac{i2\pi}{2N+1}}}{1+e^{\frac{i2\pi}{2N+1}}}=-1$$
then
$$\frac12\cdot\left\lfloor\frac n2\right\rfloor-\frac12\mathfrak{Re}\left(\sum\limits_{k=1}^{\left\lfloor\frac n2\right\rfloor}\exp\left((2k-1)\frac{2i\pi}n\right)\right)=\frac12 N+\frac14 = \frac{2N+1}{4}=\frac n 4$$
