For which $d \in \mathbb{Z}$ is $\mathbb{Z}[\sqrt{d}]$ a unique factorization domain? Is there a general criterion which tells me whether $\mathbb{Z}[\sqrt{d}]$, $d \in \mathbb{Z}$ is a unique factorization domain?
$\mathbb{Z}[\sqrt{-5}]$ is a frequent example for non-unique factorization domains because 6 has two different factorizations. $\mathbb{Z}[\sqrt{-1}]$ on the other hand is a Euclidean domain. But I'm not even sure about simple examples like $\mathbb{Z}[\sqrt{2}]$.

Yes, there is. But first there is the matter of integral closure (I prefer to think of it as "completeness") to attend to. If $d \equiv 1 \pmod 4$, then you need $\frac{1 + \sqrt{d}}{2}$ instead of $d$. For example, with $d = 13$, $1 + \sqrt{13}$ is an algebraic integer, but so is $\frac{1 + \sqrt{13}}{2}$. For fun, try this in your calculator: $$\left(\frac{1 - \sqrt{13}}{2}\right)\left(\frac{1 + \sqrt{13}}{2}\right) = ?$$

The criterion is $h(4d) = 1$ if $d \not \equiv 1 \pmod 4$, $h(d) = 1$ if so. $h(d)$ is a function that tells you the class number of $\mathcal{O}_{\textbf{Q}(\sqrt{d})}$. I now quote the formula for $h(d)$ from Mathworld: if $d$ is positive, $$h(d) = -\frac{1}{2 \log \eta(d)} \sum_{r = 1}^{d - 1} \left(\frac{d}{r}\right) \log \sin \left(\frac{\pi r}{d}\right),$$ see http://mathworld.wolfram.com/ClassNumber.html for a full explanation of this, make sure to substitute $4d$ as needed. That also gives the formula for $d$ negative, but since there are only nine such values...
