Curves and Sums-of-Powers Representations

Jacobi first noticed the connection between the functions that bear his name and counting the representations of sums-of-squares, \begin{eqnarray} \theta_{3}^{n}(q) = \left( \sum_{k \in \mathbb{Z}} q^{k^{2}} \right)^{n} = \sum_{k \geq 0} r_{2,n}(k) \ q^{k}, \end{eqnarray} where $q = e^{\pi i \tau}$ (or $e^{2 \pi i \tau}$ depending on which text you consult) and $r_{2,n}(k)$ is the number of ways to represent $k$ as a sum of $n$ squares, i.e., the integral solutions of the equation $k = x_{1}^{2} + \dots + x_{n}^{2}$. The Jacobi theta functions, including $\theta_{3}$, are known to satisfy a myriad of symmetries and identities.

Question: Are these identities related in any way to the family of curves $\{ X^{2} + Y^{2} = k \}_{k \in \mathbb{N}}$? If so, how?

Suppose, more generally, I'd like to count $m$-powers instead of squares. The corresponding $q$-series is then \begin{eqnarray} \left( \sum_{k \in \mathbb{Z}} q^{k^{m}} \right)^{n} = \sum_{k \geq 0} r_{m,n}(k) \ q^{k}, \end{eqnarray} If the answer to the first question is yes, then this function (known?) and its symmetries should then be intimately connected to $\{ X_{1}^{m} + X_{2}^{m} + \dots + X_{n}^{m} = k \}_{k \in \mathbb{N}}$, a family of deformations of the homogeneous hypersurface $F = \sum_{i = 1}^{n} X_{i}^{m} = 0$.

Generalizing further still, let $F = F(X_1, \dots, X_n)$ be a $\mathbb{Z}$-polynomial in $n$ indeterminates. Let $a(k)$ count the number of ways that an integer $k$ can be represented by $F$ over the integers. What general characteristics are known about the function $\sum_{k \geq 0} a(k) \ q^{k}$? Can one determine its symmetries by the symmetries of $\{ F(X_1, \dots, X_n) = k \}_{k \in \mathbb{N}}$ as a family of deformations of the hypersurface $F = 0$? Can one define a related $L$-function and presuppose its functional identities similarly?

Any clarification is certainly appreciated!

-