What are the primes in quadratic integer ring $\mathbb{Z}[D]$ Is it possible to classify all the primes in the ring of integers $\mathbb{Z}[D]\subseteq\mathbb{Q}(\sqrt{d})$? If not, are there additional assumptions on $d$ like residue mod 4 or the "class number" of $\mathbb{Z}[D]$ that make it possible?
I am also interested in whether $\mathbb{Z}[D]$ always has units other than $\pm 1$. I know that the units are precisely those of unit norm, i.e. the solutions to $a^2-D^2b^2 = \pm 1$.
(I know this question and ones similar to it have been asked before, but I couldn't find a good answer.)
 A: Every prime ideal $\mathfrak p$ in $\mathbf Z[D]$  is above a prime $p\in \mathbf Z$, i.e. $\mathfrak p\cap \mathbf Z=p\mathbf Z$.
Now for a given odd prime $p$,


*

*either $p$ is inert, i.e. $p\mathbf Z[D]$ is a prime ideal. It is the case if $d$ is not a square mod.  $p$,

*or $p$ is decomposed,  i.e. there exist two prime ideals  $\mathfrak p_1$ and  $\mathfrak p_2$ in $\mathbf Z[D]$, such that $p\mathbf Z[D]=\mathfrak p_1\cap\mathfrak p_2$. It is the case if $d$ is a (non-zero) square mod. $p$

*or $p$ is ramified, i.e. there exists a prime ideal $\mathfrak p$ such that $p\mathbf Z[D]=\mathfrak p^2$. It is the case if $d$ is a multiple of $p$.


$2$ is inert if $d\equiv 5\mod8$, decomposed if $d\equiv 1\mod8$, ramified otherwise.
As to the group of units, it is a finite group if $d<0$, and more precisely it has order $4$ for the ring of Gaussian integers ($d=-1$), $6$ for the group of Eisenstein integers ($d=-3$), $2$ otherwise.
If $d>0$, the group of units is isomorphice to the product of the group $\{\pm1\}$ and a monogeneous group (i. e. t is isomorphic to $\mathbf Z$).
Dirichlet's unit theorem describes the structure of the ring of integers of any algebraic number field.
