Efficient way to regulate voltage
Yes, a resistor will consume energy, but that's not the main reason not to use one. The voltage drop across the resistor will vary with the current, so if your load isn't constant (it never is) the voltage will vary. That's not what you want from a regulator. Never use a series resistor as a voltage regulator!
There are two big categories of voltage regulator: linear and switcher.
A linear regulator usually comes as a three-legger: an input pin, ground and an output pin. Typical example: LM7805. They have good regulation and are easy to use. Main drawback: they're not efficient. The load current passes through the regulator, and causes a voltage drop there, like the series resistor would. If your 5V circuit draws 1A you'll draw that 1A from the 9V, so the load's 5W will require 9W from your power supply, that's an efficiency of 55%. This becomes even worse if your input voltage is higher, like 24V. With an input voltage this high the regulator needs considerable cooling. You don't want a linear regulator for this kind of application.
A switcher (or SMPS, for Switched-Mode Power Supply) is the solution. This uses a coil to build up a magnetic field, which in turn is converted back into the output voltage. Switchers are a bit more complicated in operation than linear regulators, but they're much more efficient; efficiencies of 95% are often possible. Since they work at higher frequencies (100s of kHz to several MHz) board layout is premium to reduce radiation. Proper component selection and careful PCB layout are also important to get high efficiency.
The good news is that switchers are very common nowadays, and designs are much simpler than 20 years ago; many switchers only need four external components. TI has a Simple Switcher series (née National Semiconductor) with online design tools.
AndrejaKo made an interesting remark. There are switcher modules which can be used as drop-in replacement for a TO-220 linear regulator:
Like he says these aren't cheap but may be the right solution if you need an efficient regulator but don't have the experience to design a switcher yourself.
Depending on what you need, there are several ways; basically, you have a tradeoff between linearity and power efficiency.
While the voltage divider with resistors is the most (in principle) linear solution, it's not good for a power supply: first because the current output unbalances the divider, and second because it's not power efficient.
So you have DC-DC converters, which do exactly what you need (convert a voltage into another one) and have different characteristics in precision, noise and efficiency.
The most efficient solution is the S-class (switching) buck converter, which uses a clock and MOS switches to create a lower voltage, which will be noisy and will need to be filtered.