How does a pump push air into the tire and take in air from somewhere else? Why doesn't air spill out from the edges of the hole where the long thing goes in and out of the tube? I'm a complete noob to pumps.
Someone made a nice video.
There is a rubber seal around the piston which makes it air-tight with the inside of the cylinder. Then there are two check valves which only let the air flow in one direction: one to allow outside air in when you pull (but not let is out when you push), and one to let the high pressure air inside your tyre (but not let it out).