how does geothermal energy work ?

Read lots:

http://www.eia.doe.gov/kids/energy.cfm?page=geothermal_home-basics

http://www.ucsusa.org/clean_energy/technology_and_impacts/energy_technologies/how-geothermal-energy-works.html

and more:
http://www.google.com/search?aq=f&sourceid=chrome&ie=UTF-8&q=geothermal+energy