Fog is a tricky forecast.
Local ground fog that commonly forms in low spots such as lakes or bogs is one thing, but more widespread dense fog is just tricky. The dew point must be near the temperature so that the relative humidity is near 100 per cent. But most of the time, these conditions will result of dew or frost instead of fog. It helps if there is cooler air and drier air above the surface layer, but the conditions in the lower few hundred feet of the atmosphere are almost impossible to know. It helps a lot if all of this is in a region of weak high pressure so that the surface wind is light but the vertical motion in the atmosphere is weak.
If all of these conditions are expected, we usually forecast fog. But even then, fog tends to form in seemingly random patches.
Once fog forms, it can be equally difficult to forecast when it will clear for all of the same reasons.