How many elements in a number field of a given norm?

Counting elements of a given norm modulo units is the same as counting principal ideals of a given norm. It's a quite difficult problem. For example, how many elements of norm $N$ are there in $\mathbf{Z}[i]$? In other words, in how many ways can we write $N$ as the sum of two squares? A theorem of Jacobi says that this is equal to four times the excess of the number of divisors of $N$ which are $\equiv 1 \mod 4$ over the number of divisors of $N$ which are $\equiv 3 \mod 4$, generalizing the theorem of Euler-Fermat about representations of primes as sums of two squares. Thus we see that for even the simplest number field $\mathbf{Q}(i)$, the situation is quite complicated (but in this case, Jacobi's theorem provides a simple formula).

The number $a_N$ of ideals of norm $N$ in $\mathcal{O}_K$ is related to the residue of the Dedekind zeta function $\zeta(s)$ at $s=1$, which is in turn related to all important invariants of $K$.

We can write

$$\zeta_K(s)=\sum_{n \geq 1}\frac{a_n}{n^s},$$

where the sum converges absolutely for $\Re s>1$.

According to the Wiener–Ikehara Tauberian theorem, since $\zeta_K$ has a simple pole at $s=1$,

$$\sum_{n\leq N}a_n \sim C_K N$$

where $C_K$ is the residue of $\zeta_K$ at $s=1$, given explicitly by the class number formula.

This gives an upper bound for the number of principal ideals of norm at most $N$, and an asymptotic expression in case $\mathcal{O}_K$ is a P.I.D.

Addendum: As pointed out by Matt, ideals are uniformly distributed among the $h$ ideal classes of $\mathcal{O}_K$. This is the heart of the class number formula.

By definition of the ideal class group of $\mathcal{O}_K$, the set of principal ideals of $\mathcal{O}_K$ is the identity element of the ideal class group. By the uniformity of the distribution, if we denote $L$ the average over $n$ of the number of principal ideals of norm $n$ as $n \to \infty$, then

$$\frac{1}{h}\sum_{n\leq N}a_n \sim \frac{1}{h}C_KN \sim LN$$

hence $$L=\frac{1}{h}C_K = \frac{2^{r_1}(2\pi)^{r_2}\text{Reg}_K}{\omega_K \sqrt{|D_K|}}$$

where $r_1$ and $r_2$ are respectively the number of real and complex infinite primes of $K$, $\text{Reg}$ is the regulator (the covolume of the unit group $\mathcal{O}_K^*$ in $K^*$), $D_K$ is the discriminant (more or less the square of the covolume of $\mathcal{O}_K$ in $K$), and $\omega_K$ is the number of roots of unity in $K^*$.

Addendum #2: I just want to point out what I think is the neatest proof of of Jacobi's theorem, using $L$-functions.

We let $K=\mathbb{Q}(i)$. By definition of the $\zeta_K(s)$, and using the fact that there are two primes of norm $p$ above $p \equiv 1 \mod 4$, one prime of norm $p^2$ above $p \equiv 3 \mod 4$, and one prime of norm $2$ above $p=2$,

$$\zeta_K(s)= (1-2^{-s})^{-1}\prod_{p \equiv 3 \mod 4} (1-p^{-2s})^{-1} \prod_{p \equiv 1 \mod 4} (1-p^{-s})^{-2}$$

which, be rearranging, can be written as $\zeta(s)L(s, \chi)$, where $\chi$ is the Dirichlet character $$p \mapsto \begin{cases}\left(\frac{-1}{p}\right) = (-1)^{(p-1)/2} && p \text{ odd}; \\ 0 && p=2\end{cases}.$$

Hence, from this identity, the coefficient of $N^{-s}$ in $\zeta_K$ is

$$a_N = \sum_{d \mid N}\chi(d),$$

which is precisely what Jacobi's theorem says, since for a general odd integer $n$ we have $\chi(n)=(-1)^{(n-1)/2} = \pm 1$ according as to $n\equiv 1$ or $n \equiv 3$ mod $4$.

$$$$


Okay here is part of an answer to your question:

Let $x \in O_K$. Then it can be shown that the norm of $x$ is the norm of the ideal $(x)$ (I am presuming you know what the norm of an ideal is. If not, take a look at Pierre Samuel's book "Algebraic Theory of Numbers"). But, since $O_K$ is a Dedekind domain, it can be shown (using an argument of unique factorization of ideals into products of primes) that there are only finitely many integral ideals in $O_K$ of a given norm. Thus, up to units, there will be only finitely many elements in $O_K$ of a given norm.

Here is the reason why there are only finitely many ideals of norm $n \in \mathbb{N}$:

Let $I \subset O_K$ be an ideal of norm $n$. Then by definition of the norm of an ideal, $|O_K/I| = n$. Thus, $n \in I$. This means that $(n)O_K \subset I$. Factorize $(n)O_K$ into a product of prime ideals. Then one can see that there are only finitely many choices for $I$.