Explain how, geothermal energy is used to generate electricity.

Extremely hot rocks present below the surface of earth heat the underground water converting it into steam. When more and more steam is formed between the rocks, it gets compressed to high pressures. This high pressure steam is brought up through pipes and is used to run the turbine of a generator to produce electricity.