Fog and mist are both made of tiny water droplets suspended in air. The difference between them is the density of the droplets. Fog is denser so contains more water droplets than mist.
Our atmosphere is made up of many gases, one of which is water vapour. It can hold a certain amount of water as invisible water vapour at any given temperature. If air is cooled it can hold less water and becomes super saturated. At saturation point, some of the water has to condense to form water droplets, which forms cloud.
Radiation fog
Radiation fog is formed on clear, still nights when the ground loses heat by radiation, and cools. The ground in turn cools the nearby air to saturation point, thus forming fog. Often the fog remains patchy and is confined to low ground, but sometimes it becomes more dense and widespread through the night.
Ideal conditions for the formation of this type of fog are light winds, clear skies and long nights. Consequently, in the UK, the months of November, December and January are most prone to foggy conditions, particularly the inland areas of England and lowlands of Scotland in high pressure conditions.
After dawn, fog tends to disperse because it is 'burnt off' by the incoming solar radiation, some of which penetrates the fog and reaches the ground. The ground heats up, as does the layer of air near it. Eventually the air reaches a temperature where the minute fog droplets evaporate and the visibility improves. However, in winter fogs can be very persistent.
Advection fog
Advection fog is formed when very mild moist air moves over a cold ground. This can often happen in early spring in the UK when mild southwesterly winds moving across the country over snowy or icy ground. The lower layers of the air get cooled down rapidly to below the temperature at which fog forms.
Hill fog
Hill fog or upslope fog, as its name implies, is formed as mild moist air is forced to ascend a hill or mountain range. As the air moves up the windward side of the mountain it cools down, and again if the air becomes saturated then cloud is formed which, if below the top of the hills, gives fog.
Coastal fog
Some coastal regions of the British Isles suffer from 'sea fog' which forms when moist air is cooled to saturation point by travelling over a cooler sea. The wind may then take the fog into coastal regions. This type of fog tends to occur in spring and Summer, and particularly affects south western and North Sea coasts.
Steam fog
'Steam fog' is sometimes seen rising from the ground after a shower. If the ground is warm, the water from the shower may evaporate. If the air above it is saturated and cannot hold any more water, the excess moisture condenses and looks like steam. This 'steaming' can also be seen at the Poles, when cold air sweeps over a slightly warmer sea. The sea warms the air a little and some water evaporates. The warmer damper air then rises, cools again and the moisture condenses.
Freezing fog
Freezing fog is made of supercooled water droplets (i.e. ones which remain liquid even though the temperature is below freezing-point). One of the characteristics of freezing fog is that rime - feathery ice crystals - is deposited on the windward side of vertical surfaces such as lamp-posts, fence-posts, overhead wires, pylons and transmitting masts.
ps - if it's foggy and you're driving in the countryside, don't put your headlamps on full beam because it reflects in the water droplets and dazzles you. Which is scary. And sort of looks like aliens are coming to get you.