Pinch flats or snakebites are caused when the rim bottoms out and tube gets pinched between the rim and the tire and punctures - usually 2 smallish holes 10mm (1/2 inch) apart, hence the name "snakebite" because that what it look like.
The two holes (or a hole and sign of damage close to it) are the tell tale sign - its rare to get a puncture from a foreign object causing two holes in quite the same pattern.
The cause is that the air pressure was not enough to prevent the tire collapsing to the point the tube is pinched. Usually a sign of too low tire pressure, but can happen when you hit something like a rock or pothole with a sharp edge.
Prevention depends on riding - for a road bike, more pressure (under inflated tires are the main cause), and check pressure before every ride. Avoid potholes and such like. For heavy riders or bad roads, bigger tires and thicker, stronger tubes can help. Mountain bikers have a different problem - often we want to run lower pressures for traction on rough ground - the very same ground that makes you susceptible to snakebites. Its not unknown to keep lowing pressure till you suffer snakebites, and bring them up a bit. There are also option for tubeless tires, which do not suffer snake bites (but can suffer bead separation if run too low pressure), and as for road bikes, bigger tires and thicker tubes.
Another preventative measure is coat the tube with talcum power before installing it. The talcum acts as a lubricant, and allows the tube to move without tearing itself apart. I have used this method on my MTB for years and it seems effective as I not had a snakebite for a long time.