It follows from the law of cosines that if $a,b,c$ are the lengths of the sides of a triangle with respective opposite angles $\alpha,\beta,\gamma$, then
$$
a^b+b^2+c^2 = 2ab\cos\gamma + 2ac\cos\beta + 2bc\cos\alpha.
$$

For a cyclic (i.e. inscribed in a circle) polygon, consider the angle "opposite" a side to be the angle between adjacent diagonals whose endpoints are those of that side (it doesn't matter which vertex of the polygon serves as the vertex of that angle).  Then for a cyclic quadrilateral with sides $a,b,c,d$ and opposite angles $\alpha,\beta,\gamma,\delta$, one can show that
$$
a^2+b^2+c^2+d^2 = 2ab\cos\gamma\cos\delta + 2ac\cos\beta\cos\delta + 2ad\cos\beta\cos\gamma$$
$${} +2bc\cos\alpha\cos\delta+2bd\cos\alpha\cos\gamma+2cd\cos\alpha\cos\beta$$
$${}-4\frac{abcd}{(\text{diameter})^2}$$
And for a cyclic pentagon, with sides $a,b,c,d,e$ and respective opposite angles $\alpha,\beta,\gamma,\delta,\varepsilon$,
$$a^2 + \cdots + e^2 = 2ab\cos\gamma\cos\delta\cos\varepsilon+\text{9 more terms}$$
$$ {} - 4\frac{abcd}{(\text{diameter})^2}\cos\varepsilon+ \text{4 more terms}.$$
And for a cyclic $n$-gon with sides $a_i$ and opposite angles $\alpha_i$,
$$\sum_{i=1}^n a_i^2 = \text{a sum of }\binom{n}{2}\text{ terms each with coefficient 2}$$
$${} - \text{a sum of }\binom{n}{4}\text{ terms each with coefficient 4}$$
$${} + \text{a sum of }\binom{n}{6}\text{ terms each with coefficient 6}$$
$${} - \cdots \text{ and so on} $$
The number of terms depends on $n$ and the power of the diameter on the bottom is in each case what is needed to make the term homogeneous of degree 2 in the side lengths ("dimensional correctness" if you like physicists' language), and the alternation of signs continues.

I showed this by induction.  It should work for infinitely many sides, too, by taking limits.  Each term would then have a product of infinitely many cosines.

<b>My question is:</b> Is there some reasonable geometric interpretation of the sum of squares of sides of a polygon inscribed in a circle?