Magic, Nah im just kidding. A battery has two parts, the anode and the cathode. Which anode is positive and cathode is negative, which they are connected to the electrolyte. Once they are connected to a device they once start working from separate ends. Which is the flow of energy