A finitely-generated module over a principal ideal domain is always isomorphic to $R^n\oplus R/a_1\oplus\cdots\oplus R/a_n$ where $n$ is a nonnegative integer and $a_i\in R$ for $i=1,\dots,n$. This is called the structure theorem for modules over a principal ideal domain. Examples of principal ideal domains include fields, $\Z$, $\Z[\sqrt{2}]$, and the polynomial ring $k[x]$ when $k$ is a field.
If $a\in R$ is not a unit, then $R/a$ is not projective, since $a$ annihilates any element of $R/a$ and therefore $R/a$ cannot be the direct summand of any free module. Therefore, we can conclude from the structure theorem that any finitely-generated projective module over a principal ideal domain is a free module. Don’t get your hopes up though: there are many examples of non-free projective modules.
But let’s stick with principal ideal domains. It is actually true that every projective module over a principal ideal domain is free. Kaplansky in [1] proved the following even stronger theorem:
It seems rather strange that an integral domain might have infinitely generated ideals, but yet have all of its finitely generated ideals principal. So what is an example of such a ring? Kaplansky doesn’t give one.
One answer lies in…valuation rings! This is rather amusing because when I started writing this post I wasn’t even thinking of valuation rings.
Recall that a ring $R$ is a valuation ring if it is a domain and for every $a,b\in R$, either $a\mid b$ or $b\mid a$. In other words, a valuation ring is a domain for which the principal ideals are linearly ordered. I talked a little bit about totally ordered sets of ideals in the last post. The ring of integers $\Z$ is not a valuation ring, but the ring $k[[x]]$ of formal power series over a field is a valuation ring! However, both of these are principal ideal domains and hence not the oddities that we desire. It follows directly from the definition of valuation ring that every finitely-generated ideal in a valuation ring is principal.
What we need is a valuation ring that is not Noetherian. Will such valuation rings please stand up?
Here’s an example. Take the monoid of nonnegative rational numbers, ${\Q}^+ = \{ a\in \Q : a\geq 0\}$ whose binary operation is addition, and take the monoid ring $\Q[\Q^+]$. It is by definition the vector space whose basis consists of the symbols $[a]$ for every $a\in \Q^+$. Multiplication is defined on symbols by $[a][b] = [a + b]$ and this defines a multiplication on all of $\Q[\Q^+]$ by extending symbol multiplication linearly.
Then $\Q[\Q^+]$ is a integral domain with vector space addition and the multiplication just defined, and it is in fact a valuation ring and so every finitely generated ideal is in fact principal. However:
Now, this assumption of $I = ([a])$ means that for each $n=1,2,\dots$ there exists an element $x\in \Q[\Q^+]$ such that $x[a] = [1/n]$. It is easy to see that $x$ itself must be of the form $[b]$ for some $b\in \Q[\Q^+]$. So in other words, for each $n$ there exists a nonnegative rational $b$ such that $a + b = 1/n$. Since $n$ is arbitrary, this implies that $a = 0$, which is impossible as $[0]\not\in I$.
Going back to Kaplansky’s theorem, we see that every projective module over the monoid ring $\Q[\Q^+]$ is free! Now how’s that for a cool example? Can you think of another way to show that every projective over this ring is free?
[1] Kaplansky, “Projective Modules”. The Annals of Mathematics, Second Series. 68 (2), September 1958, pp.372-377.