I will begin by saying that $k=3$ might be a very specific case and this question is useless. Even if that is the case, I would like to know...
The sum of squares function $r_k(n)$ is very famous. It counts the number of ways $n$ can be written as a sum of $k$ squares. In the case of $k=3$, when $n$ is squarefree and not $7\mod{8}$, $r_k(n)$ is related to the class number of $\mathbb{Q}(\sqrt{-n})$. In the next (at least) two odd cases the function is still related to arithmetic constants of quadratic fields. C.f. "On the Representation of a Number as the Sum of any Number of Squares, and in Particular of five or seven", Hardy, 1918.
Question
Are the numbers $r_k(n)$ known to be related to special groups, like when $k=3$?
Smaller Question
Is there a book with an in-depth account of these numbers and their arithmetic significance? (more than expressing them as coefficients of a modular form and proving bounds and (lots of) relations...)