For water condensation to occur inside the bottle, the temperature of the air in the bottle must be cooling below the air's dew point. This is done in the science classroom using plastic bottles, to demonstrate cloud formation. A small amount of water is placed in an empty plastic soft drink bottle, and the bottle is next capped tightly and shaken for a couple of minutes to saturate the air in the bottle with water vapor. The bottle is then compressed and held that way for a minute, and then the pressure is suddenly released. The re-expansion causes the air in the bottle to cool below its dew point, resulting in a cloud of tiny water droplets. The effect is much greater if condensation nuclei are present - smoke serves this purpose well, but a solid surface can also.
I'm speculating, but it could be that when the bottle is corked, the air inside is compressed in the process. Then, if the bottle is placed in a cooler environment, the dew point might be reached before the water vapor in the bottle has time to re-establish equilibrium with the liquid. Or possibly, there is enough loss of pressure through leakage around the cork, to allow the air inside to expand enough to cool it below its dew point. The surface inside the neck of the bottle must have microscopic regions that serve as nucleation points that initiate formation of the water droplets.
That's the general idea, anyway!
Steve