Overinflated tires can be prone to flats, since the increased air pressure puts more stress on all parts of the tube and the tire. Overinflated tires also provide less traction.
A tire with too little air pressure will not only ride poorly, but will also be prone to pinch flats, which happen when the tube is pinched against the rim while going over a bump. Tires naturally lose air over time, and will eventually go flat if more air is not pumped into them.
All modern bike tires have pressure recommendations printed on the side of the tire. Each time you ride, check to make sure your tire is inflated to the correct pressure.
Properly inflated tires will resist flats, ride comfortably, provide traction, and help the bike perform efficiently and safely.
Many tires specify a range of pressures (such as 50 to 70 psi). If this is the case with your tires, feel free to experiment. In general, heavier riders should use a higher pressure. Also, lower pressures are better for riding on soft surfaces, such as sand, mud, or snow.