How does a Class group measure the failure of Unique factorization? I have been stuck with a severe problem from last few days. I have developed some intuition for my-self in understanding the class group, but I lost the track of it in my brain. So I am now facing a hell. 
The Class group is given by $\rm{Cl}(F)=$ {Fractional Ideals of F} / {Principle fractional Ideals of F} ,  ($F$ is a quadratic number field)  so that we are actually removing the Principal fractional ideals there  (that's what I understood by quotient group). But how can that class group measure the failure of Unique Factorization ? 
For example a common example that can be found in any text books is $\mathbb{Z[\sqrt{-5}]}$
in which we can factorize $6=2\cdot3=(1+\sqrt{-5})(1-\sqrt{-5})$. So it fails to have unique factorization. Now can someone kindly clarify these points ? 


*

*How can one construct $\rm{Cl}(\sqrt{-5})$ by using the quotient groups ? 

*What are the elements of $\rm{Cl}(\sqrt{-5})$ ? What do those elements indicate ? ( I think they must some-how indicate the residues that are preventing the $\mathbb{Z[\sqrt{-5}]}$ from having a unique factorization ) 

*What does $h(n)$ indicate ? ( Class number ). When $h(n)=1$ it implies that unique factorization exists . But what does the $1$ in $h(n)=1$ indicate. It means that there is one element in the class group , but doesn't that prevent Unique Factorization ? 
EDIT: 

I am interested in knowing whether are there any polynomial time running algorithms that list out all the numbers that fail to hold the unique factorization with in a number field ?

I am expecting that may be Class group might have something to do with these things. By using the class group of a number field can we extract all such numbers ? For example, if we plug in $\mathbb{Z}[\sqrt{-5}]$ then we need to have $6$ and other numbers that don't admit to a unique factorization. 
Please do answer the above points and save me from confusion . 
Thank you.
 A: For your third bullet, if there's only one element to the class group, then unique factorization holds because then all the fractional ideals are principal, and in particular the ring of integers is a principal ideal domain, which is equivalent to unique factorization for Dedekind rings.
As to the first two, I'll only state that the class group of $\mathbb{Z}[\sqrt{-5}]$ is $\mathbb{Z}/2\mathbb{Z}$. Maybe someone else can help you out with the details of the computation, but we can be sure the group isn't trivially due to examples like $(1+\sqrt{-5},1-\sqrt{-5})$. You can see that this ideal squares to $(2)$, and that the class group is $\mathbb{Z}/2\mathbb{Z}$ just tells that in fact every ideal is either principal or the square root of a principal. Unfortunately, you can see we lose a lot of information in passing to the class group, and in particular it doesn't tell us anything at all about which elements are obstacles to unique factorization. The intuition, rather, is that a more complicated class group implies we're further from unique factorization.
A: First of all, I want to clarify one thing: taking the quotient by the subgroup of principal ideals is not the same thing as removing the subgroup. It means that two fractional ideals $\frak{A}$ and $\frak{B}$ are equivalent iff $\frak{A}^{-1}\frak{B}$ is a principal ideal.
In general, if one wants to compute the class group of a number field, the first thing you might want to do is compute the class number; a good way to tackle this is to first compute an upper bound for the class number. For this purpose, you can use Minkowski's bound:
$$M_F:=\sqrt{|D|}\left(\dfrac{4}{\pi}\right)^{r_2}\dfrac{n!}{n^n},$$
where $F$ is a number field of degree $n$ over $\mathbb{Q}$, $D$ is the discriminant, $r_2$ is half the number of complex embeddings. In general, every class in the class group contains an ideal of norm at most $M_F$, and so the class group is generated by the prime ideals of norm at most $M_F$. By studying the splitting of the rational prime ideals in $F$, you can deduce a lot of information about the class group. To see example of computations, I highly recommend this note by Keith Conrad.

Here are two ways of thinking about a Dedekind domain with class number equal to 1. First, for Dedekind domains, being a Unique factorisation domain (UFD) is equivalent to being a Principal ideal domain (PID) (this basically follows from the fact that Dedekind domains are Noetherian integral domains in which every nonzero prime ideal is maximal). Therefore, a Dedekind domain has a trivial class group if and only if every ideal is principal, if and only if it is a UFD. Second, we know that in Dedekind domains, every fractional ideal has a unique factorisation into prime ideals. Hence, you can think of the class group as being a comparison between unique factorisation of fractional ideals and unique factorisation per se.
A: h=1 means that the size of the class group is 1. That means that the group is the trivial group with only one element, the identity. The identity element of the class group is the equivalence class of principal ideals. Hence h=1 is equivalent to "all fractional ideals are principal" or equivalently "all ideals are principal".
A: The idea is that for the ring of integers $R$ of a number field, $R$ is a UFD if and only if $R$ is a PID. Only one way of this holds in general, the ring of integers is a special setting.
So it is enough to study the ideals of $R$. The above result basically tells us that any principal ideals in a factorisation of an ideal of $R$ are no obstacle to unique factorisation of elements, so it is enough to throw them away and study the "bad" ideals, i.e. the non-principal ones. But even some of these can be considered to produce the "same" obstruction to $R$ being a UFD.
By creating the quotient we are in some sense carrying all of this out, the non-identity elements should describe all genuinely different obstructions to $R$ being a UFD. If there is only one element in the quotient then clearly there are no obstructions since every ideal is principal, hence $R$ is a UFD. 
A: There are various ways to interpret how class groups measure (non)unique factorization. For example, Carlitz (1960) showed that the class group has order at most $2$ iff all factorizations of a nonzero nonunit into irreducibles have the same number of factors. Narkiewicz posed the problem of generalizing this, i.e. devising arithmetical characterizations of class groups. Following is one such characterization, due to J. Kaczorowski, Colloq. Math.  48 (1984), no. 2, 265-267.
Let $\,\cal O\,$ denotes the ring of integers of an algebraic number field. An algebraic integer $\rm\,a\in \cal O\,$ is said to be completely irreducible if it is irreducible and $\rm\,a^n\,$ has a unique factorization for all $\rm\,n\in \Bbb N.\,$ Let $\rm\ {\rm ord}\, a\ $ be the least  $\rm\,n\in \Bbb N\,$ such that the length of any factorization of $\rm\,ab\,$ is $\rm\,\le n\,$ for any completely irreducible $\rm\,b\in \cal O.\:$ A sequence of nonassociate algebraic integers $\rm\,a_1,\ldots, a_k\,$ is said to be good if each $\rm\,a_i\,$ is completely irreducible but not prime, and their product $\rm\, a_1\cdots a_k\,$ factors uniquely. Suppose that $\rm\,a_1,\ldots,a_k\,$ is a good sequence having maximal $\rm\,\prod {\rm ord}\,a_i.\,$ Then $\cal O$ has class group $\,\rm\cong C({\rm ord}\, a_1\!) \oplus \cdots \oplus C({\rm ord}\,a_k\!),\:$ where $\rm \,C(n) \cong $ cyclic group of order $\rm\,n.\,$ A proof can be found in Chapter $9$ of Narkiewicz's book Elementary and Analytic Theory of Algebraic Numbers.
Similar results were also published by F. Halter-Koch, and D.E. Rush around the same time. Since then these results have been generalized and abstracted into a powerful theory of nonunique factorization in Krull monoids. Search on said authors and Geroldinger to learn more.
Below is Geroldinger's summary of this line of research, from a paper in Jnl. Algebra 1990

Almost $20$ years ago, W. Narkiewicz posed the problem to give an arithmetical characterization of the ideal class group of an algebraic number field ([13, problem 32]). In the meantime there are various answers to this question if the ideal class group has a special form. (cf. [4], [5], [12] and the literature cited there).
The general case was treated by J. Koczorowski [11], F. Halter-Koch [8], [9, §5] and D. E. Rush [16]. In principle they proceed in the following way: they considera finite sequence $(a_i)_{i=1\ldots r}$ of algebraic integers, requiring a condition of independence and a condition of maximality. Thereby the condition of independence guarantees that the ideal classes $g_i$ of one respectively all prime ideals $g_i$ appearing in the prime ideal decomposition of $a_i$ are independent in a group theoretical sense. The invariants of the class group are extracted from arithmetical properties of the $a_i$’s, and the condition of maximality ensures that one arrives at the full class group but not at a subgroup.

