Geothermal power generation requires a significant heat source beneath the ground.
In many cases, that heat source is from a hot-spot, where magma rises through the crust near to the surface. This most often happens near the edges of tectonic plates and in volcanically active regions. To generate electricity, water is pumped deep into the ground, where the heat from the magma turns it into steam. That steam is then allowed to rise to the surface, where it is directed into a steam turbine, which spins and generates electricity like any coal or gas fired power station. To see where geothermal power can be harnessed in the US, see this map.