That's a mouthful, but it's important to understand in order to have a useful discussion of the conditions that existed when the first stars and first galaxies in the universe formed. Many important open questions in astrophysics right now have to do with the nature of these events. Since I expect to discuss some of these questions, it's necessary to say some things about the "dark ages". That's what this note is about.
Let's start with the CMB. I'm going to give just a sketch. You might want to consult other references if you need more detail.
The period of time in which the CMB emerged is also known as the period of recombination. This was not an instantaneous process, but it did proceed relatively quickly, and is often thought of as a single event.
Basically, before recombination matter (mostly hydrogen and helium) and energy (light, i. e. photons) existed in thermal equilibrium. That is, the following reaction could occur with equal probability in either direction:
H + γ ⇄ p + e-
Here, H stands for a hydrogen atom (with one electron), γ is a photon, p is a proton, and e- is an electron. (We'll ignore helium, for simplicity.) What this formula says is that a photon of sufficient energy could dislodge an electron from a hydrogen atom to form a proton and a free electron, and with equal probability protons and free electrons could combine to form a hydrogen atom and a photon.
As the universe cooled after the big bang, the average temperature of the matter-energy plasma steadily dropped. Before the period of recombination, hydrogen atoms could exist, but not for very long, because most photons had enough energy to completely dislodge an electron, so the reaction went from left to right as often as from right to left.
Over a period of time lasting a few tens of thousands of years the situation changed so that most photons no longer had enough energy to dislodge an electron. (A low energy photon could still interact or "scatter" with a hydrogen atom by raising an electron to a higher energy level, but we can gloss over that detail.) Note that the average or "typical" photon energy may be a lot lower than what's needed to dislodge an electron, as long as there are still enough higher-energy photons around. This is a statistical situation governed by the Maxwell-Boltzmann equation, but all that really matters is that eventually photons and neutral hydrogen atoms "decouple" statistically.
So at some point you have recombination, when electrons combine with protons to make neutral hydrogen, and the process (mostly) doesn't reverse. Occasionally, a photon and a hydrogen atom may still interact, but as the universe expands, it's increasingly less likely for a photon and an atom to come close enough to interact, until the probability of interaction is essentially zero. This second stage is sometimes referred to as "decoupling" of matter and photons.
Thus the period of "dark ages" began right after the relatively brief process of recombination and decoupling. For simplicity, we date this point to a single time when the process was about half complete, roughly 380,000 years after the big bang.
This period is termed "dark", even though there were plenty of photons around, because there were as yet no stars or other compact sources of illumination. (There's another reasons for calling it "dark", which we'll get to in a moment.)
CMB photons have a nearly perfect black-body distribution. There is a clear peak of maximum energy in this distribution. What we observe is that this peak occurs at about 2 mm, in the microwave part of the spectrum. But the time of decoupling, 380,000 years after the big bang, corresponds to a redshift of z≈1100, so at the time of decoupling the peak photon energy was around a wavelength of just 2.2 μm (2200 nm) in the infrared part of the electromagnetic spectrum. (If you need to refresh your memory about how redshift works, check here.) So "dark" is not exactly the right term to use, but compared to abundant light from stars, it's not unreasonable.
After the time of recombination/decoupling, most hydrogen and helium atoms were neutral and un-ionized. This went on for several hundred million years. One of the most interesting open questions is about determining more exactly how long this lasted. We can reasonably guess what probably brought the dark ages to an end: formation of the first stars in the universe. But we don't have a good idea of just when this started, or how long the process took.
In this period, matter was beginning slowly to come together in higher-density clumps under the force of gravity. Dark matter, which outweighed ordinary matter then (as now), by a ratio of about 5.5:1 speeded up this process.
It was precisely this formation of regions of higher matter density that enabled the first stars to form. But because of this same higher density of matter around newborn stars, the abundant high-energy photons produced by these stars were again likely to interact with the nearby un-ionized matter, which scattered them and reduced their energy – dimming the light of these first stars.
One of the large uncertainties concerns the characteristics of this first generation of stars. We have no direct evidence about them. What we think we know about them is based on theoretical models rather than direct observation. (We discussed formation of the first stars back here.) However, it's widely believed that these stars were unlike stars formed later, right up to the present time. The first stars were probably quite large (maybe as much as 200 solar masses), very hot, and very bright. Because they burned their fuel so rapidly, their lifetimes would be very short, perhaps less than a million years.
Some of the light from extremely hot, massive stars such as those of the first generation is well into the ultraviolet part of the spectrum, around 90 nm. Such photons have an energy above 13.6 eV (91.2 nm wavelength), enough to completely ionize hydrogen. If these stars formed, say, 400 million years after the big bang, at a redshift of z≈11, the wavelength of their light would be shifted to the area beyond 1100 nm, which is in the infrared. That's beyond the range of human eyes, or most astronomical instruments. Consequently, we would have a very hard time detecting light from the first stars, even if they weren't so far away (over 13 billion light-years) and obscured by clouds of atomic hydrogen. That time period would still seem "dark" to us – there would be very little we could "see".
However, the first stars radiated so much energy, especially at ultraviolet wavelengths, that over time they effectively reionized all of the hydrogen in their vicinity. And this is (probably) what brought about the epoch of reionization in the universe, effectively ending the "dark ages".
The first stars were probably not part of galaxies, though we don't know for sure. If that's the case, they would be even harder to observe. The first objects we will be able to detect from this period almost certainly will be galaxies or quasars (which are galaxies with a very active central black hole). So the question of when galaxies began to form is separate, but equally puzzling. There is evidence that the first galaxies in fact did form before the end of the dark ages – because we can actually observe a few that show evidence of un-ionized hydrogen.
What we can say for sure is that the first stars must have consisted only of the primordial elements hydrogen and helium, since heavier elements (except for a small trace of lithium) formed and dispersed only when the first stars exploded as supernovae. But that did happen rather quickly, since the first stars were very luminous, and consequently had very brief lives.
As noted, we aren't very sure about when this first generation of stars appeared, because we can't yet observe them directly. But we do have some evidence concerning the epoch of reionization, and hence we have some idea of when it ended.
One kind of evidence involves studying the spectra of some of the most distant objects we are currently able to observe – quasars. We have detected a number of quasars at redshifts between 6 and 7. This range represents a time period from about 780 to 950 million years after the big bang.
There are absorption lines in the spectra of these quasars, and they tell us not only about the redshift, but give other information as well. Among the most important lines are those due to hydrogen that's not fully ionized, such as lines of the Lyman series. For the most part these lines are due to hydrogen in the vicinity of the source, in which case the lines are quite sharp and distinct.
But suppose there is a substantial amount of incompletely ionized hydrogen between us and the source. If this gas is at a distance sufficiently less (in terms of redshift), the absorption lines will be fuzzy instead of sharp. This effect is called a Gunn-Peterson trough.
In 2001 a quasar was identified at z=6.28, which showed a Gunn-Peterson trough, while other quasars with z≤6 did not. This suggests that reionization was mostly complete by 950 million years after the big bang, but not by 900 million years. 
Quasars, by themselves, are a possible contributor to reionization, in addition to the earliest stars. Quasars certainly produce enough high-energy photons. However, the question is whether there were enough quasars in existence during the epoch of reionization to account for the effect. Since only the very brightest quasars can currently be observed at that distance (z≥6), it's not possible to reliably estimate how many quasars altogether were around then. Rough estimates suggest there weren't enough.
There is another source of evidence for reionization, one very different from the Gunn-Peterson trough. This involves a very detailed study of anisotropies (irregularities at small angular scales) in the CMB. The CMB has many anisotropies due to conditions existing from the earliest moments after the big bang. However, if reionization occurred, certain kinds of additional characteristic anisotropies will also be present. These result from polarization of CMB light due to Thomson scattering of photons by free electrons (if such exist in sufficient numbers). Since free electrons are a by-product of reionization, they provide a very good marker, if they can be detected.
Unfortunately, the earliest data analysis (in 2003) from the Wilkinson Microwave Anisotropy Probe suggested that reionization occurred in the range 11<z<30, which corresponds to a mere 100 million to 420 million years after the big bang. This is not compatible with the quasar evidence. It's also rather implausible at the high z end, if reionization was caused by the first stars.
Fortunately, however, later data analysis (released in 2008) restated the range for reionization to 7≤z≤11.  z=7 still doesn't quite mesh with the quasar data, but it's pretty close. z=11 corresponds to 420 million years after the big bang, which is quite plausible for appearance of the first stars. Note that if this range is correct, then the reionization process took a lot of time, maybe 400 to 500 million years. First generation stars almost certainly weren't around that long. Such stars have very short lifetimes, and new stars of this kind can't form, because the gas from which they could form would contain considerable amounts of elements heavier than helium, precluding the formation of more stars like those of the first generation.
A third possible source of evidence comes from surveys looking for very faint, high-redshift galaxies (not quasars). Some objects have been found up to z=7.5 – about 710 million years after the big bang.  What isn't clear is whether these objects were either abundant enough or had hot enough stars to contribute significantly to reionization. But when the James Webb Space Telescope goes to work, sometime after mid-2013, we should be able to find many more early galaxies. The planned upgrade to the Hubble Space Telescope this year would also help – if it occurs.
 Evidence for Reionization at z ~ 6: Detection of a Gunn-Peterson Trough in a z = 6.28 Quasar – 2001 research article on first evidence for reionization (open access)
 First Light: Astronomers Use Distant Quasar To Probe Cosmic "Dark Age," Universe Origins (8/8/01) – press release describing the preceding research
 A New Day in Precision Cosmology (3/11/08) – news article describing analysis of WMAP data, including information on reionization
 Largest Sample Of Very Distant Galaxies Ever Seen Provide New Insights Into Early Universe (7/24/08) – press release
Tags: cosmology, cosmic dark ages