Equality between sums It's not obvious for me that
$$
\sum_{r=-n}^n (n+1-|r|)\exp(irs) = \left(\sum_{k=0}^n \exp(i(k-n/2)s)\right)^2
$$
I checked with Mathematica the correctness of the formula. Then, I tried :

*

*Cauchy-Schwarz,

*separate positive indices and nonpositive indices in the lhs,

*change the indice $k = r+n/2$,

*Write

$$
\sum_{r=-n}^n (n+1-|r|)\exp(irs) = \sum_{j=0}^n  \sum_{r=-j}^j \exp(irs),
$$
 A: It is straightforward as soon as we know that
$$
(1+w+\dots w^n)^2=\sum_{k=0}^n (k+1) w^k + \sum_{k=n+1}^{2n} (2n+1-k) w^k
$$
Then
$$
w^{-n}(1+w+\dots w^n)^2=\sum_{k=-n}^0 (n+1+k) w^k + \sum_{k=1}^{n} (n+1-k) w^k
=\sum_{k=-n}^n (n+1-|k|) w^k
$$
and the result follows from $w=\exp(i s)$.
A: Start with the RHS:
$$
\left(\sum_{k=0}^{n} \exp(is(k-n/2))\right)^2=\left(\exp(-isn/2)\sum_{k=0}^{n} \exp(isk)\right)^2
$$This is a geometric series:
$$
=\exp(-isn)\cdot \left(\frac{1-\exp(is(n+1))}{1-\exp(is)}\right)^2
$$
$$
=\exp(-isn)\cdot \frac{1-2\exp(is(n+1))+\exp(2is(n+1))}{1-2\exp(is)+\exp(2 i s)}
$$
$$
= \frac{\exp(-i s n)-2\exp(is)+\exp(is(n+2))}{1-2\exp(is)+\exp(2 i s)}
$$
$$
= \frac{\exp(-i s (n+1))-2+\exp(is(n+1))}{\exp(-is)(1-2\exp(is)+\exp(2 i s))}
$$
$$
= \frac{-2+2\cos(s(n+1))}{-2+2\cos(s)}
$$
$$
=\frac{1-\cos((n+1)s)}{1-\cos(s)}
$$Now on the LHS we have:
$$
 (n+1)\sum_{r=-n}^n \exp(i r s) =(n+1)\sum_{r=-n}^{n} \cos(r s)
$$
$$
=2(n+1)\left(-1+\sum_{r=0}^{n}\cos(r s)\right)
$$This sum is well-known, and we can use angle-addition to clean things up:
$$
=2(n+1)\left(-1+\csc \left(\frac{s}{2}\right) \sin \left(\frac{1}{2} (n+1) s\right) \cos \left(\frac{n
   s}{2}\right)\right)
$$
$$
=(n+1)\csc \left(\frac{s}{2}\right) \sin \left(\frac{1}{2} (n+1) s\right)
$$Lastly, we have
$$
-\sum_{r=-n}^{n}|r| \exp(i r s)=-2\sum_{r=0}^{n} r\cos( r s)
$$This sum also admits a closed-form, though not as nice as the other two:
$$
=-2\cdot \frac{1-n \cos (n s)-\cos (n s)+n \cos ((n+1) s)}{1-\cos (s)}
$$
$$
=\frac{1-(n+1) \cos (n s)+n \cos ((n+1) s)}{1-\cos(s)}
$$Gluing the LHS together and slogging through the angle addition does the trick.
$$
LHS (1-\cos(s))
$$
$$
= (n+1)\csc \left(\frac{s}{2}\right) \sin \left(\frac{1}{2} (n+1) s\right)(1-\cos(s))+(1-(n+1) \cos (n s)+n \cos ((n+1) s))
$$
$$
=1-\cos((n+1) s)=RHS (1-\cos(s))
$$
