My Apple Wireless Mouse was turning on and off. I first thought it might be some kind of radio interference. Instead of guessing I Googled. The top hits were for the Apple Support Blog--where the world's wealthiest company, the world's most advanced technology company relies on self-selected users to solve the technical problems it's phone operators cannot.
The blog was helpful but only in that it focused my attention on the battery connection. The highest rated advice was well meaning nonsense, batteries had to be just the right size..... or they won't work.
There's that much variation between AA batteries that the spring loaded battery holders won't work?
Suspiciously the advice recommends buying rechargeable batteries from the Apple Store--they're 'just the right size.'
All this reminds me of Wozniak in college with his TV frequency interference box in his pocket. (Read Woz's autobiography it's honest and interesting.) He would flip the switch and make the TV picture go crazy. Someone would try fiddling with the rabbit ear antenna, and he'd turn off the interference.
He worked this to the point that a guy was standing next to the TV with one foot in the air. If he put down that foot, Woz flipped the switch.....
Maybe the battery size thing is like this.
The other helpful thing in these postings is that tapping the Wireless Mouse on the table top would cause the problem. I tried this and yes, it absolutely caused the problem.
I doubt there's any significant variation in AA batteries worldwide that could cause such a problem, but a perennial problem of ALL battery connections is corrosion between the battery terminals and the device.
I once bought a used Minolta Spot Meter that was attacking erratically, I got if for 1/4 of the cost of a new one. I took it home, cleaned up the contacts with a pencil eraser and used it for the next fifteen years. I'm sure it's still good.
So I tried the pencil eraser on the Wireless Mouse. I also used it on the Eneloop rechargeable batteries I use in my mouse. Surprisingly the problem got much worse. That was surprising. I just had this happen with my car, where the electrical system goes completely dead. Tapping on the battery connectors immediately solves the problem. (You then need to clean them, but usually you can drive home, drive for a week after just a tap.)
There are better ways to clean battery contacts. I happened to have some alcohol based hand sanitizer, so using a Q-tip I cleaned up the contacts. It's been working 100% for the past week.
The best place for this information is on the Apple Support Blog. Unfortunately, I haven't been able to log in on this site in a couple of years. I'm really annoyed with how Apple handles IDs and Passwords. After a few years of hassles I've finally got iTunes and iTunes App Store sorted, but whatever gets me into the Apple Support blog... I don't have enough time to bother with. Let the guys with one foot in the air have their moment in the sun.
So use alcohol and a Q-tip rub the contacts on the mouse, and if you use rechargeables clean the contacts on these as well.
One thing you don't want to do is use sandpaper or scrape these surfaces. I used to do this, because it works when you're soldering (or sweating copper plumbing pipes). It damages the surface of the contact exposing unplated metal to oxidation (corrosion).
Something else that will help is, after cleaning, to use electrical contact grease. This seals the area from air eliminating oxidation. It seems a little weird to slather the surface of an electrical contact with non-conducting grease, but the grease doesn't keep the metals from contact, they push the grease out of the way, make the contact. Anywhere they are not touching is sealed from the air.
I hope this helps.