Hydrogen is a fuel that can be obtained from water and electricity to store the electrical energy. To covert back the hydrogen back into useful energy, the simplest method would be to burn hydrogen to release heat energy and then convert that heat energy into useful electrical energy. However, burning hydrogen and the process after the combustion have low efficiencies.
The alternative method which is the most popular amongst the hydrogen sector are fuel cells. Fuel cells are electrochemical machines that will react a fuel to extract useful electrical energy. There are different designs of fuel cells that work with different fuels such as natural gas or methanol.
A fuel cell is a device that converts chemical potential energy (energy stored in molecular bonds) into electrical energy. The reactants are hydrogen and oxygen, to produce water, electricity and heat. This is a big improvement over internal combustion engines, coal burning power plants, and nuclear power plants, all of which produce harmful by-products.
Since oxygen is readily available in the atmosphere, we only need to supply the fuel cell with hydrogen, which can come from an electrolysis process.