If the flashlight makes light when you switch it on, then the batteries are not completely depleted of energy. You may reverse the directions of all of the batteries in an ordinary flashlight and, provided that (and here's the important part!) the batteries still make good electrical contact with the parts of the flashlight they need to make contact with, the light bulb should light the same. The light bulb is just a thin wire of tungsten in a glass bulb with the air taken out, and it doesn't really care which way the electricity flows.
What is probably happening in your case is that the action of taking the batteries out, turning them around, and putting them back in again rubs the electrical contacts on the batteries and in the flashlight, scratching off a thin layer of oxide or corrosion that may be on the metals. Oxides often make good electrical insulators and are a real problem in making reliable electrical contacts. Contacts which must be of high reliability are often coated in gold or some other metal which does not oxidize easily. Flashlights, alas, usually fall in the inexpensive category here. An ordinary flashlight usually has a spring on the bottom and a plastic bulb holder with a piece of metal on the bottom for making contact with the batteries pushed against it by the spring (or sometimes just the bottom of the bulb is exposed). The spring, the bulb's contact, and the switch may all rust or corrode. These oxide coatings may even be present in brand-new flashlights and batteries.
The same effect is usually why a flashlight may start working when you hit it. The motion scratches the contacts and makes for better electrical conduction. Sometimes if things are bent out of shape and don't fit right, banging a flashlight can make it stop working, too. Often, cleaning the contacts with Scotch-Brite (the green abrasive stuff on dish sponges, or any competing brand will work as well) will make them at least temporarily work much better, that is, until they oxidize again.
Another thing that could be going on (I cannot tell exactly from your question whether this is what you are asking about) is that the batteries just need a "rest" when they are nearly depleted. The end products of the chemical reactions in the battery build up fastest near the electrodes inside the battery. If you run a battery down and then turn the flashlight's switch off, some of the chemicals may mix back a little bit by diffusion during the "resting" period. Switching the flashlight on after a break can give a short period of extra light from the flashlight, but it is often dim and dies away rather quickly (since you said "will work like it normally would" I originally thought this wasn't what was going on for you, but nearly dead batteries do behave in this manner.) You can experiment on this "resting" effect by trying different kinds of batteries -- alkaline vs. carbon zinc batteries, and try doing this at different temperatures -- that will affect the diffusion rate.
If you have some batteries that are really dead (check them with a voltmeter to make sure they read zero volts), then they will not light your flashlight no matter how you put them in. If your flashlight has two batteries and you put them in with opposing polarities, one up and one down, you won't do any damage, but your flashlight won't work. This is because the voltages of the two batteries subtract to zero instead of adding to +3 volts.
(published on 10/22/2007)