A couple days ago I was at a restaurant drinking my cup of water through a straw. I childishly put my finger on top of the straw in the cup of water, and I pulled out the straw. I noticed that the water was not pouring out from underneath the straw. I found this very confusing since I only covered the top of the straw, the second I uncovered the top of the straw the liquid then poured out the straw. Can someone please explain why this was the case?
the reason that the water would not run out of the tube is that because of the surface tension of the water and the diameter of the tube, it did not support two-phase flow (in which water runs out the bottom of the tube while air simultaneously runs in the bottom of the tube). if you tried this with progressively larger diameter tubes, eventually you get the case where the meniscus at the bottom end of the tube will evert and water will run out while air runs in.
You can also elicit this response by breaking the surface tension of the water with some detergent. A tube diameter which does not support two-phase flow with pure water will if the water has a little detergent in it.
this is an important design consideration when designing (of all things) turkey basting bulbs. a properly designed basting tube has a diameter inside the tip which does not allow two-phase flow, so if you slurp up a full load of juice off the bottom of the pan and lift the tube free of the pan, the liquid stays put in the tube. If the tube diameter is too large, then the juice runs out and air runs in and you spill the contents of the baster.
this same principle is used to control the dispensing of water out the nozzle of a watering tube, as used for hamsters and mice. if the nozzle is too big, water will run out the tube (and air will run in) without an animal licking at it.
This is a result of atmospheric pressure. With your finger over the top of the straw, there is no air there, and so atmospheric pressure only acts on the bottom end of the straw. The pressure is large enough to counteract gravity - atmospheric pressure is equivalent to the pressure exerted by about 10 meters of water. Once you lift your finger, there is air on top of the straw. The pressure at the top and at the bottom cancel, and the water escapes thanks to gravity.
You can read more about this by Googling for 'barometer'. The system you describe is a simple barometer.
There is air in the straw between your finger and the fluid level in the straw. If only a few drops of liquid come out of the straw before it stops flowing, then, by the ideal gas law, the air in the head space will have expanded, and its pressure will have dropped to a little lower value than atmospheric. Basically, you have formed a slight vacuum in the head space. The difference in pressure between the bottom of the liquid column and the top of the column is enough to support the weight of the liquid.