When TV remote isn't working, I rotate the batteries in the remote in their place and it begins to work. I don't see any kind of deposit between the batteries and the contacts. Rotation of battery doesn't seem to be a meaningful factor by itself that can change the energy output. So, how?
When the batteries are almost too low to operate the device anything that improves conductivity will help, shaking the remote, twisting the batteries, warming them, and even pressing the buttons extra hard can get the remote to function when electricity supply is marginal.
The nickel plating on the battery contacts forms a thin invisible oxide layer, but it's not usually thick enough to stop the remote from working, twisting the batteries breaks that layer and slightly improves the connection. warming the batteries enhances the strenght of the chemical reaction inside the batteries, that helps too.
What you should do is replace the batteries, that will work for longer.
The contact areas (of the battery and battery holder) are probably bad.
By rotating them, you'll grind the contacts a bit and the contact points will change all the time. You probably turn the batteries (repeat the described process) untill the contact areas are connected well enough so the remote is working again.
Bad contacts may not be always clearly visible.
Maybe cleaning the contacts with a glass fiber pen/brush will improve it.
I do this all the time, it doesn't matter what order the batteries are seated, as long as they are disconnected and then reconnected. It also works in devices with one battery.
This is my guess, I do know that batteries develop polarization as they are discharged. In a device like a remote, there is a small leakage current (most likely below the uA range). Even with the small current, it polarizes the battery and reduces the voltage. If the battery is removed, the voltage recovers and resets the battery somewhat (but is only temporary because the battery is mostly discharged and at the end of it's life)
You can see how current changes with the amount of current in a battery, if there is no current, then the battery goes back to it's nominal voltage, and the voltage increases.
It's possible that the polarization effect increases with depth of discharge, but I couldn't find any experimental evidence that would suggest this, might be fun to run some experiments on polarization over time.