This fact is known as "the classification of surfaces". For a particularly non elementary view see http://www.math.uchicago.edu/~shmuel/tom-readings/ranicki-intro, chapter 4.