How can a lens have a range of focal lengths? Shouldn't it be a single number?
Isn't focal length supposed to be fixed for a lens of a particular shape and geometry?
What am I missing?
How many lenses are actually there in a "lens"?
A range of focal lengths indicates a zoom lens. There are two major classes of lenses. Primes, or primary lenses, have a single focal length. They tend to be higher quality, as there can be fewer lens elements, and fewer moving element groups. One exception to this rule is super telephoto prime lenses, particularly faster lenses (f/2.8), which are some of the most advanced optics on earth, and contain numerous element groups with special types of lens elements (i.e. ultra low dispersion glass, fluorite lenses, aspherical elements, etc.)
The other class are zoom lenses, and they have a range of focal lengths. They generally have more element groups overall, and usually have several moving groups. The length of a zoom lens can be increased or shortened, thus changing the focal length. The quality of a zoom lens depends on its construction. Some have great quality at one end of the range, and lesser quality at the other end. Some have great quality at the ends of the focal range, but lesser quality in the center of the range. Super telephoto zooms also often have special types of lens elements.
To answer the question about "how many lenses are in a lens", the question depends. Some lenses have few lens elements (individual glass or other material lenses within a camera lens body), and others have many. The number of lens elements in a given lens is usually an indication of a few things. Lower quality lenses tend to have fewer elements, and the glass used in those elements tends to be of a lower quality (less dense, greater chance of splitting light and causing things like chromatic aberration.) Lower-end lenses may have 3-5 lens elements total. Higher quality lenses tend to have more elements, and often larger elements. Many high-end lenses tend to have more lens elements, around 5-10. Higher end telephoto lenses may have 14-20 lens elements or more. More glass is generally required to produce wider apertures, and having a very wide front lens element often requires additional lens elements to focus that light down to a size that can pass through the lens mount into your camera. As focal length increases, maintaining the quality of the generated image often requires additional elements that serve different purposes. High end telephoto lenses often contain aspherical elements, ultra-low dispersion elements, fluorite elements, movable element groups, etc. These additional lens elements increase the control the lens has over light, but also increase the overall weight of the lens, and its manufacturing complexity.
By moving the glass elements in and out, you change the focal length.
Imagine holding a magnifying glass up to your eye. As you pull away the glass, you're chaning the focal length.
This is what happens in a zoom lens when you rotate the zoom ring. You're essentially moving one or more optical elements in and out, changing the focal point.
The two numbers themselves, refer to the min and max values of the focal length. At 18mm, you are setting the focal point 18mm away from the camera's focal plane (the film plane or image sensor). At 55mm, the focal point is 55mm from the camera's focal plane.
18-55 mm gives you a range of focal lengths for a lens, although in practice, camera lenses are actually several lenses that move in complex ways together to adjust focus etc.
A lens will have a fixed deflection of the rays striking it, so if the rays of light striking it are parallel you would have a fixed focal length. If you have partially focused rays striking it, then it will adjust the overall focal length. In reality, it's a fair bit more complex by having many lens elements (in the case of the Canon 18-55mm f/3.5-5.6, 11 lenses) in 9 separate groups that can all move relative to each other allowing the range in focal lengths, as well as focusing.
One thing to remember, particularly when determining which lens to buy in regards to focal length, is the crop factor of your camera's sensor. Lenses designed for full frame cameras will produce a narrower field of view on an APS-C or similar sized sensor, as found in most non-professional D-SLR's and micro 4/3rds cameras, with exceptions.
Lens focal lengths are commonly specified in relation to a full frame (35mm) sensor, given it's heritage in film cameras. Most enthusiast and entry level D-SLR cameras will be APS-C size or similar, which has a crop factor of 1.6. This means an 18mm focal length on an APS-C sized sensor will produce a field of view the same as a 28.8mm focal length on a full frame sensor.