electronic devices don’t only involve electronic components, they also include mechanical designs too. For instance, an t.v. or, in the case of a remote. The remotes are built with some separation between the parts in order to make things quickly fixed. If you hit or shake the remote’s battery, they weren’t in contact with the terminal of the remote. When you hit the remote , the batteries, due to random vibrations, were unable to contact the terminal and then re-enter contact. This is the scenario that occurs in a lot of appliances. I hope that this will help. Good Luck!