The remainder of $1^2+3^2+5^2+7^2+\cdots+1013^2$ divided by $8$ How to find the remainder of $1^2+3^2+5^2+7^2+\cdots+1013^2$ divided by $8$

Of course, you could just sum the series:
$$\sum_{k=1}^n (2 k-1)^2 = \frac{4 n (n+1)(n-1)}{3} + n$$
In this case, $n=507$, and you want $507 (4 \cdot 169 \cdot 506 + 1) \mod{8}$.
