By using metals.
Metals have a convenient property called conduction, in which the electrons in the metal are not bound to just one atom at a time as in other materials, but are free to wander from atom to atom. This allows the metals to conduct electricity, because electricity is just charged particles moving through something like a wire.
Many other things can also conduct electricity. For example, hydrochloric acid is a good conductor. When hydrogen chloride (HCl) dissolves in water, it breaks up into hydrogen ions (H+) and chloride ions (Cl-). These electrically charged particles can move through the water. Moving charged particles is electricity.
If we put a strip of aluminum into the acid, and a strip of copper into the acid, and then connect the two metal strips to a meter, we can watch the electricity being created. Copper holds onto electrons more tightly than aluminum does. Electrons start to move from the aluminum, through the meter, to the copper.
This leaves the aluminum with a positive charge. It attracts the negative chloride ions to it, through the water. The chloride ions attract positive aluminum ions away from the metal strip, into the water, where they form an aluminum chloride solution.
At the copper strip, the extra electrons attract the hydrogen ions in the solution to migrate towards the copper. When they get there, they can steal the electrons, to become hydrogen gas. The hydrogen gas bubbles up out of the solution.
This keeps up until there is no more aluminum left on the aluminum strip. All the electrons flowing from the aluminum to the copper have been moving the needle of the meter, showing us that electricity has been produced.