The process is called fractional distillation and consists of two steps, the first relies on cooling the air to a very low temperature (i.e. converting it into a liquid), the second involves heating it up thus allowing each gas within the mixture to evaporate at its own boiling point. The key to success here is that every element within air has its own unique boiling temperature. As long as we know these boiling temperatures we know when to collect each gas.
So what are the real world benefits of separating and extracting these gases? Well liquid oxygen is used to power rockets, oxygen gas is used in breathing apparatus, nitrogen is used to make fertilizers, the nitric acid component of nitrogen is used in explosives.
The other gases all have their own uses too, for example argon is used to fill up the empty space in most light bulbs (thanks to its unreactive nature). Carbon dioxide is used in fire extinguishers and is great for putting out fires in burning liquids and electrical fires. There really are too many uses to list but suffice it to say that fractional distillation is an extremely useful process for humans the world over.