A broad general answer would suggest that firstly, snakes eat anything they can overpower. And secondly, snakes will eat anything they can swallow.
This is a fair comment, but not entirely correct.
The problem lies not in the answer, but rather in the question itself... To provide a definitive answer it is important to know which species is being discussed.
For example: Stating that peolpe eat meat is only partly true, there are of course vegetarians. Similarly, some people may eat all types of meat whilst others may only eat selected meats.
This applies for snakes too.
What do snakes eat? Well, to begin with all snakes are predatorsirrespective of their environment, whether it be terrestrial, or aquatic. They are experts at taking advantage of any prey resource within their habitat. Prey resources include "warm-blooded" vertebrates(birds, or mammals), "cold-blooded" vertebrates (amphibians, fish, and other reptiles), and "invertebrates" (Insects, spiders, crustaceans,snails, and worms). Some snakes will also eat eggs.
There is one particular snake, the tentacled snake (Erpeton tentaculum) which also eats aquatic plants. This is the only known snake to eat vegetation.
There are two factors that determine what a snake eats: the environment (habitat) the animal lives in, and the size of the animal.
The habitat will determine the availability (abundance) and selected types of prey. Generally, the preferred prey for any particular species coincides with the abundance of that particular prey species within that habitat.
It is understandable that the prey species of a Western Diamond-back Rattlesnake (Crotalus atrox) living close to suburbia will differ greatly to one living in the desert miles away from civilization.
The size of the snake also determines the prey item. It is quite common for young snakes to ingest completley different prey items to that of the adults of that species. This is usually the case where there is a significant difference in size between young and adult snakes of the same species.
Conversely, if there is little difference in size between young and adult snakes then the prey items are the same.
In some species, both males and females will have different preferences of prey species.
As with all life on earth, at some point in the evolutionary process, species either became specialists, or generalists. Snakes are no exception.
The 'Choice' is not an easy one to make.
Becoming a specialist means that a species may need to undergo certain behavioural as well as morphological changes in order to successfully exploit a certain food type. It is also important to specialise in a food item that is not already exploited by generalists. To become a specialist it is imperative to 'know' that there is an abundance of that certain food type, and more importantly, that it will remain available throughout the year.
As a result of this, there are far more generalists in the snake world than there are specialists.
Being a generalist however, means that a species may need to compete with other species, not only snakes, for the same prey or food item.
Specialists are more vulnerable to climatic and ecological changes that may affect a certain food supply, however, they are usually better equipped to deal with a particular type of prey than a generalist would be.
So, what do snakes eat?
Listed below are a few unusual species with specific dietary requirements:
The Slug-eater (Duberria lutrix) feeds almost exclusively on snails and slugs.
The Spine-tailed seasnake (Aipysurus eydouxii) only eats fish eggs.
The Common Egg-eater (Dasypeltis scabra) eats only birds' eggs.
Oddly enough there are also records of snakes eating themselves. The term used to describe this strange behaviour is "Autophagy".
So, next time somebody asks you "What do snakes eat?"
Fix yourself a drink...pull up a chair...sit down...smile, and ask "How much time have you got?"