Here is a sketch of the proof. Rescaling, you can assume $l=1$ without loss.
The vertices of the regular polygon are $V_1,V_2,\ldots,V_n$ where
$V_k$ has coordinates $(\cos(k\frac{2\pi}{n}),\sin(k\frac{2\pi}{n}))$.
Denote by $I_k$ the middle point of the segment $[V_kV_{k+1}]$. Using
the prosthaphaeresis formulas, we obtain
$$I_k\ \Bigg(\cos\bigg(k\frac{2\pi}{n}\bigg)\cos\bigg(\frac{(2k+1)\pi}{n}\bigg),
\cos\bigg(k\frac{2\pi}{n}\bigg)\sin\bigg(\frac{(2k+1)\pi}{n}\bigg)\Bigg)\tag{1}$$
Since all the $I_k$ are on the incircle, we deduce
$r=OI_k=|\cos\bigg(\frac{2\pi}{n}\bigg)|$.
If $P(x,y)$ is a point on the incircle, let us put $\theta=\frac{2\pi}{n}$ and $T=\sum_{k=1}^n PV_k^2$. Then :
$$
\begin{array}{lcl}
T &=& \sum_{k=1}^n (x-\cos(k\theta))^2+(y-\sin(k\theta))^2 \\
&=& \sum_{k=1}^n x^2+y^2-2\cos(k\theta)x-2\sin(k\theta)y+1 \\
&=& n(r^2+1)-2x\Bigg(\sum_{k=1}^n\cos(k\theta)\Bigg)
-2y\Bigg(\sum_{k=1}^n\sin(k\theta)\Bigg) \\
\end{array}
$$
Now, each of the sums $C=\sum_{k=1}^n\cos(k\theta)$ and $S=\sum_{k=1}^n\sin(k\theta)$ are zero. For $S$, this is easy :
the fact that the sine function is odd suffices. For $C$, this is very easy using complex numbers, and a
little harder if you won’t use complex numbers (hint : use two different symmetries, according to whether $n$ is even or odd).
So $T=n(r^2+1)$ is indeed independent of $P$. The rest is simple trigonometric manipulation.