Batteries produce electricity by means of chemical action. A battery contains two different conductors, or electrodes. Usually, one of these is the metal case of the battery. The electrodes are separated by a conducting liquid or paste, called the electrolyte. The substances in the battery react chemically with each other to produce an electrical current. As a result of chemical activity a positive charge builds up at one electrode, and this can flow through a conductor such as a wire to the other (negative) electrode. Eventually the chemical energy runs out and the battery becomes exhausted.

Picture credit: google