ok..
temperature changes the ability for air to hold moisture.
The warner the air the more moisture it can hold, and vice versa
So when you heat the air with a hairdryer for example you increase the temperature of the air, encourage evaporation and so it clears.
however when the air cools the condensation will reappear as you have effectively sealed in warm humid air which looses its ability to hold moisture as the temperature drops.
This is also why we get condensation on windows, especially in the winter as the air is humid inside the car (often due to people wearing coats) but also the air cannot hold so much moisture. then, added to this the glass is cold, so when the air is cooled by the glass you get condensation.
When people wash cars, they often cool the lense and so if the moisture in the headlight is at a reasonable level then the cool lense lowers air temp and voila. (also if there are any small entry points water ingress is possible).
There are a few cures to condenation:
dehumidification
heating the glass/lense.. (thus steam free mirrors)
air circulation... (as per bathrooms with extrator fans)
Headlight units have issues, as they are effectly poorly sealed sealed units. What i mean is, if you put dehumidified air in them and sealed them 100% then great! - one
problem, not many are 100% sealed, and you wouldnt be happy paying out for a whole new headlight everytime a bulb goes... so they end up being excessible / not sealed properly. I am also sure they dont go to the trouble of dehumidification.
The other option is to have good air circulation.. (air changes) but again there is a downside as the headlight is open to the elements...
Hedlights end up being neither sealed nor open. (but closer to being a sealed unit that anything else.
So what to do...
In your case, use the hair dryer as you did before.. but then finish it off by blowing some cold hair through, then leave the cover off for a good period so that humid air is removed. doing this on a day when the temperature and humidity is lower would be preferable.
You can then re-seal the unit, but there are no guarantees...
Some have increased air circulation by drilling holes in the rear of the headlight unit and fitting pipework or covers to prevent water imgress... but id not recommend this at this stage.