The classification theorem of closed surfaces tells us that any connected closed surface is homeomorphic to one of:
$1)$ The unit sphere
$2)$ The connected sum of $g$ tori (surface of genus $g$)
$3)$ The connected sum of $k$ real projective planes.
(Where $k,g$ are positive integers.)
So if a particular surface falls into the second category (that is to say, is homeomorphic to a connected sum of $g$ tori) we say that it has genus $g$. It can be pictured as the number of "holes" in the surface.