The Joule Thief mentioned in another answer is an excellent way to harvest the dregs of battery power. However, if surface mount components are not a problem, one can do slightly better.
Look for ultra low power energy harvesting boost converters from Linear Technologies, Texas Instruments and perhaps other manufacturers.
For instance, the TI BQ25504 can harvest energy down to 80 mV supply, as long as an initial 330 mV is available for starting the process. Typical depleted primary cell batteries will provide a higher voltage under no-load than under load, so getting that initial 330 mV at start-up is not difficult.
The standard application circuit from the datasheet is thus:
This is be pretty effective in sucking residual energy out of your depleted batteries down to nearly the last drop.
For something simpler but with less challenging requirements, the SparkFun LiPower boost converter, which uses the TPS61200 boost converter IC, can be easily modified to work down to 0.5 Volt supply power: The original designer of the LiPower board has posted a blog on how to do this modification.
The key advantage these solutions have over the joule thief is the high switching frequency used, courtesy the highly integrated design, and thus the much smaller inductor required. At the end of the day, they are all conceptually similar approaches, with a quantitative difference in execution.
The problems start once the battery you are tapping has gone flat.
The other batteries in the circuit may still have enough charge to push current the wrong way through the discharged battery, causing overheating, off-gasing and other damage.
Then when you come to recharge it, you have the opposite problem: in order to put current into the discharged battery, you also have to put it through the fully charged batteries.
The best solution for this is either an entirely separate battery or a suitably-rated (at least 60V on the input) buck converter.
Best Answer
A simple model of a battery is a chemical reaction which produces a constant voltage. But, this chemical reaction takes time. A simple model of the limited speed of that reaction in electrical terms is a series resistance:
simulate this circuit – Schematic created using CircuitLab
When the battery is fresh, R1 is small. As the chemical energy is depleted, R1 gets bigger. Why this happens is complicated, and I'm not a chemist, so I can't tell you in detail, but it has to do with the reactants being used up, and the battery plates getting covered in cruft, and so on.
This resistance, even though it's a combination of electrical and chemical effects, isn't exempt from the laws of physics. It still experiences a loss according to Joule's law:
$$ P = I^2 R $$
This loss of electrical energy must be accompanied by a gain of thermal energy.
If you aren't mixing batteries, then as the batteries become dead, all their resistances rise about the same, so while R goes up, the increasing \$R\$ also limits the maximum current \$I\$ that the batteries can supply. Most batteries1 are designed to be safe under any of these conditions.
However, if you mix fresh and dead batteries, then you have the fresh battery which can deliver a large current, into a dead battery which has a high resistance. This results in excessive heat in the dead battery, which may then be damaged or fail, perhaps spectacularly.
1: but certainly not all batteries. Lithium ion batteries, somewhat infamously are not safe when shorted.