If the air is humid enough, the water vapor in it begins condensing into tiny water droplets that float in the air - fog. This kind of fog is call ground fog because it hugs the ground, often no more than a couple of hundred feet thick. Wind can prevent formation of fog. Wind blowing over hills, trees, houses and other obstructions becomes turbulent with up and down motion. This pushes cold air upward from the ground and brings down warmer air, keeping the air from becoming cool enough to create fog.
Fog often forms in low places because as the air cools it becomes heavier and flows downhill.
After dawn, the sun's heat begins warming the ground and air, evaporating the fog.