Usually dark areas
Almost all snakes adapt to suit specific habitats, and most have certain requirements that dictate where they prefer to live. Most species live in dark, damp areas with plenty of cover, such as in wood piles, un-mowed lawns with tall grass, beneath overgrown shrubbery, near pond banks, within heavily mulched flower beds, or even in unkempt basements.
Other animals dens
Snakes will also occasionally occupy the abandoned burrows of other small animals. Some types of snakes live among trees or in the ocean. As carnivorous predators, snakes prefer to live near places with abundant rodent or insect populations.
More info about what snakes like to eat.
Snakes also bask in the sunlight on warm days, since, as cold-blooded animals, they rely on external heat sources to regulate their body temperature.