If you’re troubleshooting an Apple Magic Mouse that is randomly disconnecting from Bluetooth (not due to moving it too far away from the Mac), try re-seating the batteries, or wedging a small wad of paper between the batteries before closing the cover (which puts additional pressure on the batteries to help secure them in place).