How they work gets real technical, and is above my explanation ability.
As far as what to order, there's various options available as far as which interface is used. There are PCIe cards, PCI cards & PCImini, as well as the more simplistic USB.
USB are simpler to deal with, PCIe cards either have a fixed antenna that sticks out the back, or you screw in the wires for the antenna and place it somewhere in the best range.
USB wifi adapters tend to be the simplest. They plug & play in some cases, some you need to install the driver from a disk.
USB versions come in various sizes, and various Wifi frequency (a/b/g/n/ac). AC is required to access 5G (which will depend on the router being used, quite a lot only support 2.4G
currently.
The more frequencies, the higher the price. A good ac capable adapter is around $40-50 at the moment (this is the cheapest I can see supporting 1+GB speeds http://www.newegg.com/Product/Product.aspx?Item=N82E16833315123&cm_re=usb_wifi-_-33-315-132-_-Product) Doesn't have the best reviews though.