The science of fog

Fog limits visibility, delays air travel, brings danger to the roads, and makes things generally spooky. But, how does it form?