In this video it is said that $nM$ for a given magic square is equal to $\sum_{i=1}^{n^2}i$, and then the result is also used for magic hexagons.
Why does this have to be the case, both for squares and hexagons? I haven't found any answers or clues on the Internet.
In a magic square, you have an $n\times n=n^2$ square to fill in, using the numbers $1,2,\dots,n^2$ (one for each box). So if you added them all up, it's $1+2+\dots+n^2$, which you can write as $$\sum_{i=1}^{n^2}i$$.