Not all snakes lay eggs--70% of them do, while the rest give live birth. Snakes that give birth to their young without laying eggs are called viviparous. These snakes live in colder climates, where eggs would not incubate as well. Snakes that lay eggs fall into two categories, oviparous and ovoviviparous. The eggs have a hard shell that protects them, and they are usually placed under leaf litter or loose soil, or within a hollow stump or burrow.
Oviparous snakes lay eggs that hatch outside of the mother after a period of development. In most cases, the embryos develop mainly outside of the mother. As Roland Bauchot says in his book "Snakes: A Natural History," female oviparous snakes will often travel far distances to find a good hiding spot for their eggs. Sometimes their eggs will share a space with the eggs of many other females. When they are ready to hatch, the young snakes must poke their way out much like a baby bird does. The behavior of the parents varies depending on the species, but many are very protective. The python, as Bauchot says, coils herself around her eggs, keeping them warm and helping them to hatch by gently squeezing her body. After young snakes are born or hatched, the parents do not take care of them.
Ovoviviparous snakes hold their eggs in their stomachs until the eggs are ready to hatch. This protects the young more fully. It makes it harder for the mother to swallow food or protect herself, however. This is probably why all egg-laying snakes have not evolved to be ovoviviparous.
The Anatomy of Egg-Laying Snakes
For the most part, a female snake lays eggs after she mates with a male snake. (An exception is the flowerpot snake, because these snakes are all female and reproduce without a male, say Maurice and Robert Burton in "International Wildlife Encyclopedia.") Female snakes have what biologists call a "vent," which leads to her cloaca, the area that semen and eggs are passed through. The amount of time until the eggs hatch, for egg-laying snakes, varies greatly depending on the breed. Some snakes lay up to 100 eggs, and baby snakes typically stay in their eggs for two to three months (sometimes shorter, in breeds that remain inside their mother's body in their shells for a period of time). They break out using a special "egg tooth." Snake eggs are very different from bird eggs. They are soft and leathery instead of hard and rigid.
So, why don't all snakes lay eggs? Being viviparous (giving birth to live young) has its advantages for some snakes. Sea snakes give birth to live young because this means they don't need to travel to the land to breed. Their young are born with the ability to swim. Snakes that live in trees often give birth to live young, too. Their young are able to start moving around in the tree canopy as soon as they are born.
There are thousands of species of snakes, and they live in many different environments. For this reason, their bodies work in different ways. An advantage to one snake can be a disadvantage to another. By looking at the environment a snake species lives in, we can understand why its biology works the way it does.