In the ring ${\mathbf Z}[\sqrt{-3}]$, the ideal $P = (2,1+\sqrt{-3})$ is prime since it has index 2 in the ring. Note $P^2 = (4,2+2\sqrt{-3},-2 + 2\sqrt{-3}) = (4,2+2\sqrt{-3}) = (2)(2,1+\sqrt{-3}) = (2)P$, where $(2)$ is the principal ideal generated by 2 in ${\mathbf Z}[\sqrt{-3}]$. If there were unique factorization of ideals into products of prime ideals in ${\mathbf Z}[\sqrt{-3}]$ then the equation $P^2 = (2)P$ would imply $P = (2)$, which is false since $1+\sqrt{-3}$ is in $P$ but it is not in $(2)$.
In fact we have $P^2 \subset (2) \subset P$ and this can be used to prove the ideal (2) does not even admit a factorization into prime ideals, as follows. If $Q$ is a prime ideal factor of (2) then $(2) \subset Q$, so $PP = P^2 \subset Q$, which implies $P \subset Q$ (from $Q$ being prime), so $Q = P$ since $P$ is a maximal ideal in ${\mathbf Z}[\sqrt{-3}]$. If (2) is a product of prime ideals then it must be a power of $P$, and $P^n \subset P^2$ for $n \geq 2$, so the strict inclusions $P^2 \subset (2) \subset P$ imply (2) is not $P^n$ for any $n \geq 0$.
The "intuition" that the ideal $P = (2,1+\sqrt{-3})$ is the key ideal to look at here is that $P$ is the conductor ideal of the order ${\mathbf Z}[\sqrt{-3}]$. The problems with unique factorization of ideals in an order are in some sense encoded in the conductor ideal of the order. So you want to learn what a conductor ideal is and look at it in several examples. For example, the ideals $I$ in ${\mathbf Z}[\sqrt{-3}]$ which are relatively prime to $P$ (meaning $I + P$ is the unit ideal (1)) do admit unique factorization into products of prime ideals relatively prime to $P$. That illustrates why problems with unique factorization of ideals in ${\mathbf Z}[\sqrt{-3}]$ are closely tied to the ideal $P$.
If you look at the ideal notation $P' = (2,1+\sqrt{-3})$ in the larger ring ${\mathbf Z}[(1+\sqrt{-3})/2]$, which we know has unique factorization of ideals, then we don't run into any problem like above because $P' = 2(1,(1+\sqrt{-3})/2) = (2)$ in ${\mathbf Z}[(1+\sqrt{-3})/2]$, so $P'$ is actually a principal ideal and the "paradoxical" equation $PP = (2)P$ in ${\mathbf Z}[\sqrt{-3}]$ corresponds in ${\mathbf Z}[(1+\sqrt{-3})/2]$ to the dumb equation $P'P' = P'P'$. (The ideal $P'$ in ${\mathbf Z}[(1+\sqrt{-3})/2]$ is prime since the quotient ring mod $P'$ is a field of size 4: ${\mathbf Z}[(1+\sqrt{-3})/2]$ is isom. as a ring to ${\mathbf Z}[x]/(x^2+x+1)$, so ${\mathbf Z}[(1+\sqrt{-3})/2]/P' = {\mathbf Z}[(1+\sqrt{-3})/2]/(2)$ is isom. to $({\mathbf Z}/2{\mathbf Z})[x]/(x^2+x+1)$, which is a field of size 4.)
When $\,n\,$ is composite $\,\Bbb Z/n\,$ is not an integral domain. Factorization theory is much more complicated in non-domains, e.g. $\rm\:x = (3+2x)(2-3x)\in \Bbb Z_6[x].\:$ Basic notions such as associate and irreducible bifurcate into a few inequivalent notions, e.g. see
When are Associates Unit Multiples?
D.D. Anderson, M. Axtell, S.J. Forman, and Joe Stickles.
Rocky Mountain J. Math. Volume 34, Number 3 (2004), 811-828.
Factorization in Commutative Rings with Zero-divisors.
D.D. Anderson, Silvia Valdes-Leon.
Rocky Mountain J. Math. Volume 28, Number 2 (1996), 439-480
Best Answer
The general criterion is that no number can be found with more than one valid, distinct factorization. This might sound like I'm merely rephrasing the question, but it's actually a reframing of the question.
Plenty of numbers (infinitely many, to be precise) in $\mathbb{Z}[\sqrt{-5}]$ have more than one factorization. $6$ is just the easiest to find. To oversimplify matters, your main concern is with the "natural" primes from 2 to $p < 4|d|$ or $p \leq d$ as needed.
Now, the case of $\mathbb{Z}[\sqrt{2}]$ is actually more complicated than you might realize. Part of the complication is that $\sqrt{2}$ is a real number and so $\mathbb{Z}[\sqrt{2}]$ has infinitely many units. This sets up the trap of infinitely many factorizations that are not distinct because they involve multiplication by units, e.g., $$7 = (3 - \sqrt{2})(3 + \sqrt{2}) = (-1)(1 - 2\sqrt{2})(1 + 2\sqrt{2}) = (5 - 3\sqrt{2})(5 + 3\sqrt{2}) = \ldots$$
But $7$ really does have only one distinct factorization in $\mathbb{Z}[\sqrt{2}]$, as you can see by dividing these numbers by $1 + \sqrt{2}$, and $\mathbb{Z}[\sqrt{2}]$ really is a UFD. But the full explanation may require me to make several assumptions about what you know.
Let's look at a "simpler" domain, $\mathbb{Z}[\sqrt{10}]$, though it certainly has some of the same traps as $\mathbb{Z}[\sqrt{2}]$: $$31 = (-1)(3 - 2\sqrt{10})(3 + 2\sqrt{10}) = (11 - 3\sqrt{10})(11 + 3\sqrt{10}) = (-1)(63 - 20\sqrt{10})(63 \ldots$$
You have to look at numbers that are already composite in $\mathbb{Z}$ to begin with. And if $d = pq$, where $p$ and $q$ are distinct primes, the choice of where to look first is obvious: $$10 = 2 \times 5 = (\sqrt{10})^2.$$
Verify that $$\frac{\sqrt{10}}{2} \not\in \mathbb{Z}[\sqrt{10}], \frac{\sqrt{10}}{5} \not\in \mathbb{Z}[\sqrt{10}], \frac{2}{\sqrt{10}} \not\in \mathbb{Z}[\sqrt{10}], \frac{5}{\sqrt{10}} \not\in \mathbb{Z}[\sqrt{10}].$$ This means that $\mathbb{Z}[\sqrt{10}]$ is not UFD and we didn't need to compute any logarithms or sines to come to this conclusion. (You're starting to see why integral closure matters in making these determinations, right?)
Contrast $\mathbb{Z}[\sqrt{6}]$: $$6 = (2 - \sqrt{6})(2 + \sqrt{6})(3 - \sqrt{6})(3 + \sqrt{6}) = (\sqrt{6})^2$$ but $$\frac{\sqrt{6}}{2 + \sqrt{6}} = 3 - \sqrt{6}$$ and so on and so forth. This means that $6 = (\sqrt{6})^2$ is an incomplete factorization, just as, say, $81 = 9^2$ is in $\mathbb{Z}$. But this is not enough to prove that $\mathbb{Z}[\sqrt{6}]$ is or is not UFD.
As it turns out, both $\mathbb{Z}[\sqrt{2}]$ and $\mathbb{Z}[\sqrt{6}]$ are UFDs, and what is probably the simplest, most common way of proving this requires a full understanding of ideals. Adapting the proof that $\mathbb{Z}$ is a UFD to these domains can be done, but that has its own pitfalls.