| MadSci Network: Engineering |
The most likely answer is that by the smack, you cause the internal battery contact points to jiggle around. This will usually scrape away a little of the always-present layer of oxidized metal on them, and lower the contact loss. Thus you get a little more power. Usually if this becomes a nuisance, the contacts may have corroded, or the springs that press the battery against the contacts (one of which usually is the spring) are a little compressed. You can go in, rub or scrape the contacts, and stretch the springs a little. This will usually clear up an intermittent battery contact problem.
Try the links in the MadSci Library for more information on Engineering.