Stainless Steel
If you want the best in corrosion protection, pick a metal that is difficult to corrode. Stainless steel is not impossible to corrode (there are various grades of stainless), but it survives in any outdoor environment and usually stays as shiny as the day you bought it. It even survives the highly corrosive environment inside pressure-treat wood.
The cons? It's a much softer metal than its regular steel cousin. If you need serious structural support, stainless is not the way to go (this is why stainless nails really aren't much of a thing). You also want to pre-drill holes (unless you buy the nice non-drill variety) because you can strip regular stainless screws far more easily.
Galvanized
There's two kinds
- Electro galvanized is meant for indirect moisture contact like roofing (where the nail isn't directly exposed, but it could get some moisture). This is the weaker of the galvanized because the process doesn't get much zinc on the fastener
- Hot-dipped is the far more common. It comes in all sorts of fasteners and can even be used for water pipe (not as good as plastic, but it'll work)
Because they're steel, you can find these in pretty much any type of fastener. Galvanized slows the process down by coating the fastener (usually steel) in zinc. As such, the zinc coating needs to corrode first before the underlying steel corrodes. But these still corrode, and they corrode fairly quickly in any place they are exposed to moisture. Don't use these anywhere you want to avoid visible rust.
Painted
Depends a lot on the paint. What you want are screws that have a semi-gloss finish (the gloss resists moisture better). These will still corrode (the threads will have their coating stripped when you screw them in), but they are generally designed to last a very long time (they are most commonly sold as deck screws). Beyond that, painted is usually slightly above galvanized in price and tends to be less prone to displaying rust (because the head is coated).
Also look for powder coating. This provides a superior paint grade as well, but it's a less-touted feature.
Other
There are some other types of coatings as well. I'm not sure what GRK/Tapcon uses in their screws but they don't tout any of the above. I doubt they're the only ones with a premium coating (GRK and Tapcon can be more expensive than stainless in some instances).
What to use?
If you're building a fence, galvanized is the cheapest (largely due to you have the option of nails). Galvanized will also offer you steel bolts, for which there isn't much substitute if you need structural support.
Screws offer more types of fastener (including the coveted stainless) and a wider variety of costs as well. I prefer screws because they often drive in easily with a power driver and you can always re-torque them if they work out of the material. I find painted work fairly well for a decent price (in fact I only keep painted ones around in longer sizes for small projects because they're only slightly more expensive than their un-coated brethren).