How was the closed form of this alternating sum of squares calculated? I am reading through this answer at socratic.org.
The question is to find the closed form of the sum
$$1^{2}-2^{2}+3^{2}-4^{2}+5^{2}-6^{2}+\ldots.$$
I understand that, if the terms were added, the sum would be
$$
\sum_{n=1}^{N} n^{2}=1^{2}+2^{2}+\ldots+N^{2}.
$$
The person goes on to say, if the series were not alternating, the sum would be
$$
S=\frac{N(N+1)}{2}
$$
But is that correct? I thought the sum of the first $N$ squares would be
$$
\frac{N(N+1)(2N+1)}{6}.
$$
Lastly, I understand moving the $-1$ constant out of the summation as such
$$
=-\sum_{n=1}^{N}(-1)^{n} n^{2}
$$
But I am completely missing how the final closed form was calculated
$$
S_{N}=-\frac{(-1)^{N} N(N+1)}{2}
$$

It is indeed not true that $\sum_{n=1}^Nn^2=\frac{N(N+1)}{2}$ for each positive integer $N$. This is easily verified by plugging in any value $N\geq2$. Of course it is true that $\sum_{n=1}^Nn=\frac{N(N+1)}{2}$. And you are indeed correct when you say that
$$\sum_{n=1}^Nn^2=\frac{N(N+1)(2N+1)}{6}.$$
Do note that if $N$ is even, say $N=2M$, then
\begin{eqnarray*}
\sum_{n=1}^N(-1)^{n+1}n^2
&=&\sum_{n=1}^M\big((-1)^{2n}(2n-1)^2+(-1)^{2n+1}(2n)^2\big).
\end{eqnarray*}
Of course $(-1)^{2n}=1$ for all $n$, and similarly $(-1)^{2n+1}=-1$. It follows that for all $n$ we have
\begin{eqnarray*}
(-1)^{2n}(2n-1)^2+(-1)^{2n+1}(2n)^2
&=&(2n-1)^2-(2n)^2\\
&=&(4n^2-4n+1)-4n^2\\
&=&1-4n.
\end{eqnarray*}
This shows that
$$\sum_{n=1}^N(-1)^{n+1}n^2=\sum_{n=1}^M(1-4n).$$
From here we can use the fact that $\sum_{n=1}^Mn=\frac{M(M+1)}{2}$ to find that
\begin{eqnarray*}
\sum_{n=1}^M(1-4n)&=&M-4\sum_{n=1}^Mn\\
&=&M-4\cdot\frac{M(M+1)}{2}\\
&=&-2M^2-M\\
&=&-\frac{N(N+1)}{2}.
\end{eqnarray*}
That proves the case where $N$ is even. If $N$ is odd, say $N=2M+1$, then
\begin{eqnarray*}
\sum_{n=1}^N(-1)^{n+1}n^2
&=&\left(\sum_{n=1}^{2M}(-1)^{n+1}n^2\right)+N^2\\
&=&-\frac{(N-1)N}{2}+N^2\\
&=&\frac{N(N+1)}{2}.
\end{eqnarray*}
This shows that although the reasoning is incorrect, the conclusion does indeed hold; that
$$\sum_{n=1}^N(-1)^{n+1}n^2=-(-1)^N\frac{N(N+1)}{2}.$$

Alternatively, you could note that
$$1^2-2^2+3^2-4^2+5^2-\ldots=(1^2+2^2+3^2+4^2+5^2+\ldots)-2(2^2+4^2+8^2+10^2+\ldots).$$
So from your observation that
$$\sum_{n=1}^Nn^2=\frac{N(N+1)(2N+1)}{6},$$
you could conclude that if $N$ is even, say $N=2M$, then
\begin{eqnarray*}
\sum_{n=1}^N(-1)^{n+1}n^2
&=&\left(\sum_{n=1}^{2M}n^2\right)-2\left(\sum_{n=1}^M(2n)^2\right)\\
&=&\frac{2M(2M+1)(4M+1)}{6}-8\frac{M(M+1)(2M+1)}{6}\\
&=&\frac{-12M^2-6M}{6}\\
&=&-\frac{N(N+1)}{2}.
\end{eqnarray*}
