It is very common to see rainbow patterns when you look at the surface of a CD, and also when you look at soap bubbles or a thin film of oil floating on still water. All three of these effects are created by constructive and destructive interference of the light hitting the film.
Think about a very thin film of oil floating on water as an example. When white light strikes the film, most of it passes through it, but some is reflected off of the top and bottom layers of the film. In the same way, when you stand in front of a window in your house, you can see a reflected image in the window. Most of the light is passing through the window and out of the house, but some is reflected back at you. The light that reflects off the top layer of a film of oil travels a slightly shorter distance than the light reflecting off the bottom layer, as shown in this figure:
In this figure, the incoming ray of light enters from the upper left. Part of the light passes straight through the film (A). Part of it reflects off the top layer of the film (B). Part of it reflects off the bottom layer of the film (C).
If the film thickness is on the order of the wavelength of light, then interference can occur. Violet light has a wavelength of about 4,000 angstroms (hundred-millionths of a centimeter), while red light has a wavelength of about 7,600 angstroms, so we are talking about an extremely thin film. As we saw in the question on rainbows, white light is made up of all different colors of light.
If the film is just the right thickness, a red light wave (a sine wave) will bounce off the top and bottom layers in perfect alignment, and the two resulting sine waves will combine to double the amount of red light seen:
Or, they may reflect exactly out of phase, and red will be eliminated.
On a CD, the surface is mirrored so the rainbow colors are much more intense. (See How CDs Work for a description of a CD's construction.) In a CD, the angle that the CD is held at controls the colors you see -- the angle controls the path difference.
Here are some interesting links: