To explain further, when you cool gases they turn into liquids - just like when you heat liquids the turn into gases (for example boiling water to make steam)
To turn air into a liquid you have to cool it a lot ( -196deg C / -320F ), this takes a serious piece of industrial equipement.
Then because nitrogen and oxygen turn into liquids at different temperatures you can heat the liquid air up until one of them (oxygen first) boils off, you ae then left with nitrogen, as chroot described.
This is called distilling and is exactly the same process as boiling off water to keep the alcohol when making whiskey - that's why they are called distilleries.
On a small scale you could also find some chemical that reaction with nitrogen but not oxygen and have that 'use-up' all the nitrogen in a sample, leaving just the oxygen. I can't think of anything suitable - most things react with oxygen better than with nitrogen.