Motivation for ray class groups Almost all books on class field theory define ray class groups out of nowhere and proceed to prove highly nontrivial theorems on them.
One naturally wonders; Where do they come from?
Of course, it's easy to answer this question when the base field is the field of rational numbers.
However, it's not clear to me at all when the base field is not the field of rational numbers.
 A: According to Neukirch's Algebraic Number Theory, Weber came to his definition of a (narrow) ray class group by trying to view the ideal class group $Cl_K$ of $K$ and $(\mathbb Z/m \mathbb Z)^\times$ (the Galois group of the cyclotomic extension $\mathbb Q(\mu_m)/\mathbb Q$) in a unified framework.
I haven't looked at Weber's work directly, so I'm not sure how he personally thought about this, but the following seems to be a natural attempt to unify these two things.
First, Weber wanted to understand (finite) abelian extensions of $K$ (or he at least wanted to understand some analogue of cyclotomic extensions of $\mathbb Q$).  The unramified ones are determined by $Cl_K$, which is the group of fractional ideals mod principal ideals.  Over $\mathbb Q$, one gets all finite abelian extensions as subfield of cyclotomic fields $\mathbb Q(\mu_m)$, which is the Kronecker-Weber theorem.
To get Galois groups of cyclotomic fields, you would like to generalize the definition of class groups so that you can get $(\mathbb Z/m \mathbb Z)^\times$ when working with ideals over $\mathbb Q$.  A natural thing to try is not to mod out by all principal ideals, which gives you the trivial
group for $\mathbb Q$, but just mod out by the principal ideals which are "1 mod $m$".  But if you do that, it doesn't make sense to work with all fractional ideals, just the ones which are prime to $m$.  (Really this idea is just the ideal analogue of considering $(\mathbb Z/m \mathbb Z)^\times$.)  Well, if you try this and do some calculations, you see this doesn't quite give you $(\mathbb Z/m \mathbb Z)^\times$ because of negative generators of principal ideals which are 1 mod $m$.  But it does work out if you work with strictly positive principal ideals.
This construction, directly applied to number fields $K$, is the definition of the (narrow) ray class group.
Edit: Hasse's "History of class field theory" in Cassels-Frohlich should shed more light on Weber's motivation.  He suggests that the work on Kronecker's Jugendtraum was an important motivating example as mentioned in KCd's comment.
