The reason for the secondary fermentation of wine in the bottle requires two points:
The first is that there is still live yeast in the wine
The second is that there is still yeast in the wine. There is sugar
Fermentation is an anaerobic reaction and requires very little oxygen, so as long as there is sugar and yeast, fermentation is completely possible in the bottle. In order to prevent fermentation in the bottle, a trace amount of sulfur dioxide is generally added to wine before bottling, so that the yeast in the wine is killed and the wine will not ferment.
Of course, there are also wines that need to be fermented in the bottle, such as sparkling wine, which needs to be fermented in the bottle to produce carbon dioxide that dissolves in the wine and creates bubbles.