GL is right to a point. It depends on the species. That one per gallon rule is way off if you are talking, say, Turbo or Astraea snails, which go about 1 per 25G for the former and one per 10G for the latter.
The really good cleaners that can in fact survive in our warmer waters are Trochus snails of a variety of species. Those you can go 1 per 5-10G.
Nassarius snails are good sand stirrers and detritus eaters but you don't want more than 1 per 3-5G.
Fighting conchs are fantastic sand stirrers and cyano contro, 1 per 30G or so.
Ceriths are good algae eaters of all sorts and if you only go with those you can do 1 per G.
But if you get all of these then you need to scale back the numbers on each.
Snails die due first to starvation because we tend to grossly overstock based on this somewhat flawed 1 per G understanding. It really depends on the species you are stocking with.
They die second due to conditions which they cannot survive in, namely, overly warm water. Most snails sold as "turbo" snails in stores and even online are either not turbos or are temperate or cool water animals and die in our tanks.
They die third because of incompatibility with other creatures (crabs) in the tank. Scarlet Reef Hermits are the safest by far to mix with snails. Any other hermits and you are asking to have your investment in snails eaten by crabs.
Before anyone contests the assertions here I ask that you have read Ron Shimek's work on this subject, which I merely summarize above. While he is a strong-willed guy and some challenge a lot of what he says about sandbeds and other things, he is widely recognized as a leading expert on the issue that is the subject of this thread and even those who lambast him for his stand on sandbeds swear by his research on these critters.