What are the rare earths?
The rare earths are a group of several elements. The widest definition includes the 15 lanthanides: La, Ce, Pr, Nd, Pm, Sm, Eu, Gd, Tb, Dy, Ho, Er, Tm, Yb and Lu, and two more elements: Sc and Y. A quick look at the periodic table gives a hint as to why Sc and Y are also considered as REE:
(modified from this)
I've marked all the REE in red borders and larger font size. You can see that the lanthanide row is actually an expansion of a hypothetical "element" that would otherwise be in period 6 and group 3, just below Sc and Y.
Why are they grouped together? All the REE share very similar chemical properties, and change continuously from La to Lu, where Y sits somewhere between Dy and Ho (properties-wise). This results from their electron configuration, but that's for another question. Notice that Pm does not have any stable isotopes and is not a naturally occurring element, so actually there are only 14+2 rare earth elements.
Why are they called rare earths? One source (also this) claims that:
This name arises from the minerals from which they were isolated,
which were uncommon oxide-type minerals. However, the use of the name
is deprecated by IUPAC, as the elements are neither rare in abundance
nor "earths" (an obsolete term for water-insoluble strongly basic
oxides of electropositive metals incapable of being smelted into metal
using late 18th century technology).
...rare earth elements are typically dispersed and not often found
concentrated as rare earth minerals in economically exploitable ore
deposits.3 It was the very scarcity of these minerals (previously
called "earths") that led to the term "rare earth".
Although the IUPAC definition includes Sc and Y in the REE, in the professional literature they are commonly distinguished. This can be easily seen in a quick Google Scholar search:
From my own personal experience, Sc is rarely considered in the geological literature considering REE. Also see https://earthscience.stackexchange.com/a/2951/725 where in the figure you can see that Sc, at least in terms of ionic radius, is unlike the rest of the REE. Y is added to the REE, but not considered a part of them, causing the rise of the term "REY" (REE+Y).
Are the rare earth elements really rare?
Not really. Here's a diagram of element abundance in Earth's crust:
(Note that according to this, Sc is not considered a REE. Conversely, the Wikipedia version of this diagram includes it.)
You can see that the REE are not that rare. The light rare earth elements are close to some transition elements in the crustal abundance, and even the the least abundance REE (Tm and Lu) are still more abundant than silver or mercury. Y and Sc are less abundant than their neighbours, but this can be attributed to the Oddo-Harkins rule and not to the fact they are are REE. So why are they still "rare"? They rarely form ore deposits of their own. While other, less abundant, metals readily concentrate and form easily exploitable economic deposits (gold nuggets, anyone?), the REE are usually dispersed within other minerals. When they do form minerals of their own (e.g. allanite, monazite, xenotime), they are usually not abundant enough to form a deposit.
Why are they associated with alkali rocks?
Alkali rocks (e.g. carbonatites, syneites, etc.) are indeed enriched in REE-bearing minerals (pyrochlore is one that comes into mind). The fine details of trace element (REE and others) enrichment of alkali rocks and the formation of alkali magmas are still debated. Still, the basic idea is now mostly well understood. Most alkali magmas form by very low degree of melting of relatively deep mantle rocks (deeper than those that produce basalts, for example). The low degree of melting causes element that are incompatible in mantle rocks to significantly concentrate in the liquid. That's why these liquids are alkali - Na and K are incompatible in the mantle, as well as REE.
You can read more about alkali magmas in chapter 9 of the excellent book "Igneous Rocks and Processes" by Robin Gill.