Results Analogous to the Two and Four Square Theorems. A result that arises out of the study of $\mathbb{Z}[i]$ is that the following are equivalent for integer primes p:
1) $p\equiv 1$ (mod 4) or $p=2$
2) $\exists a,b\in\mathbb{Z}$ such that $p=a^2+b^2$
3) $p$ is not prime in $\mathbb{Z}[i]$
4) $\exists n\in\mathbb{Z}$ such that $p|n^2+1$
There exist similar statements for the Eisenstein Integers ($p\cong 1$ (mod 3) or $p=3$ / $p=a^2-ab+b^2$ / $p$ is not prime in $\mathbb{Z}[\omega]$ / $p|n^2-n+1$), and for the Quaternions with half-integer coefficients ($p\cong 1$ (mod 2) / $p$ is the sum of four squares / $p$ not prime / $p|(n^2+m^2+1)$)
Are there other rings for which analogous statements can be proven? Is there a general classification of such results?
 A: Yes. Analogous questions motivated much of the early development of number theory. You can find a beautiful exposition on this and related topics in David Cox's book Primes of the form $x^2 + n y^2.$ Below is an excerpt from the introduction.

Most first courses in number theory or abstract algebra prove a theorem of 
Fermat which states that for an odd prime p, 
$$ p = x^2 + y^2,\ x,y \in \Bbb Z \iff  p \equiv 1 \pmod 4.$$
This is only the first of many related results that appear in Fermat's works. 
For example, Fermat also states that if p is an odd prime, then 
$$\begin{eqnarray} p = x^2 + 2y^2,\ x,y \in \Bbb Z &\iff& p \equiv  1,3 \pmod 8 \\
\\
p = x^2 + 3y^2,\ x,y \in \Bbb Z &\iff&  p \equiv 3\ \ {\rm or}\ \ p \equiv 1 \pmod 3.\end{eqnarray} $$
These facts are lovely in their own right, but they also make one curious 
to know what happens for primes of the form $x^2 + 5y^2,\ x^2 + 6y^2,$ etc. This 
leads to the basic question of the whole book, which we formulate as  follows: 
Basic Question 0.1. $\ $ Given a positive integer $n,$ which primes $p$ can be expressed in the form 
$$ p = x^2 + n y^2 $$
where $x$ and $y$ are integers? 
We will answer this question completely, and along the way we will  encounter some remarkably rich areas of number theory. The first steps will 
be easy, involving only quadratic reciprocity and the elementary theory of 
quadratic forms in two variables over $\Bbb Z.$ These methods work nicely in the 
special cases considered above by Fermat. Using genus theory and cubic 
and biquadratic reciprocity, we can treat some more cases, but elementary 
methods fail to solve the problem in general. To proceed further, we need 
class field theory. This provides an abstract solution to the problem, but 
doesn't give explicit criteria for a particular choice of $n$ in $x^2 + n y^2.$
The final step uses modular functions and complex multiplication to show that 
for a given n, there is an algorithm for answering our question of when 
$ p = x^2 + n y^2.$ 
A: Well, a wrong kind of generalization is Waring's problem, which is most presumably not what you want. In general, the four square theorem holds for not only primes, but all integers.
Essentially, the proof uses ring of Hurwitz quaternions, i.e., basis being the usual $Q_8$ and componenets being $\mathbb Z + 1/2$. The proof of two squares cannot really be generalized to this ring, as it does not have unique factorization, but the norm is Euclidean, thus right ideals of $H$ are $ \bf PID$s.
There is an analogue, i.e., Legendre's three squares theorem the proves that any integer not of the form $N = 4^k(8k'+1)$ is expressible as sum of three squares.
In general, Waring's problem asks for minimum $g(k)$ number of $k$-th powers needed to express any integer. Hardy-Littlwood $G(k)$ is defined to be the smallest number of $k$-th powers needed to express all integers $N \geq N_0$.
Several developments have done using the polynomial identities like Euler and Fibonacci. The proof of $g(3) = 9$ is based upon such polynomial equivalences. In general, $G(k)$ estimates are mostly based on exponential Gau$\beta$-like sums. In short, as $k$ grows, one mostly uses analytic number theory than ring theory much, which are useful for smaller exponents. 
