The swap partition (or file) in linux is equivalent to the page file in Windows. It's used for offloading the RAM. If the RAM gets full, the OS can use the swap partition as extra RAM.
As for how to determine your swap size, the rule of thumb is (used to be) 2x the amount of RAM in your machine. So if you had 512MB of ram, you would have a 1GB swap partition. This rule is largely outdated though. So if you have more than say 2GB of ram, you don't really need 4GB of swap.
I normally make my swap size equal to the ram size + 10%. It has to be equal to the RAM size so that you can use suspend to disk features, and then + 10% for good measure.