The sum of the squares of the first \(n\) integers can be written as:
$$ 1^2 + 2^2 + 3^2 + ... + (n-1)^2 + n^2 = \frac{(n)(n+1)(2n+1)}{6} $$
Rearranging:
\begin{align} 1^2 + 2^2 + 3^2 + ... + (n-1)^2 &= \frac{(n)(n+1)(2n+1)}{6} - n^2 \\ &= \frac{(n)(n-1)(2n-1)}{6} \end{align}
If \([1^2 + 2^2 + 3^2 + ... + (n-1)^2 ≡ 0 \bmod n]\), then:
\begin{gather} \frac{(n)(n-1)(2n-1)}{6} ≡ 0 \bmod n \\ \frac{(n)(n-1)(2n-1)}{6} = nk \implies (n-1)(2n-1) = 6k \end{gather}
This means \([6|(n-1)(2n-1)]\). For this to be true, \((n-1)(2n-1)\) needs to be divisible by 2 as well. Since \((2n-1)\) is odd for all values of \(n\), then \((n-1)\) would have to be even for \((n-1)(2n-1)\) to be divisible by 2. In other words, \(n\) would have to be odd:
\begin{gather} n \not \equiv 0 \mod 6 \\ n \not \equiv 2 \mod 6 \\ n \not \equiv 4 \mod 6 \end{gather}
Now let's say that \(n\) is a multiple of 3:
$$ (n-1)(2n-1) = 6k = (3q-1)(6q-1) $$
This will lead to a contradiction:
\begin{gather} 3q ≡ 0 \bmod 3 \implies 3q -1 ≡ -1 \bmod 3 \\ 6q ≡ 0 \bmod 3 \implies 6q-1 ≡ -1 \bmod 3 \\ (3q-1)(6q-1) ≡ (-1)(-1) \bmod 3 \\ 6k ≡ 1 \bmod 3 \end{gather}
So \(n\) cannot be a multiple of 3:
\begin{gather} n \not \equiv 0 \mod 6 \\ n \not \equiv 3 \mod 6 \end{gather}
This means \([n ≡ 1 \bmod 6]\) or \([n ≡ 5 \bmod 6]\). In other words \([n ≡ ±1 \bmod 6]\).