Unfortunately, part of hobodaves answer is wrong.
The fermentation does not stop when there is no sugar left in the wine, but when the condition for the bacteria that eat the sugar and produce alcohol and CO2 do not permit it to live there any longer / multiply at a sufficient rate. usually, this happens not due to lack of sugar, but to the rise in the alcohol concentration of the wine.
If you start with grape juice that is very sweet, a lot of the sugar will still be left in the wine and you get a sweet wine. If you start with a low amount of sugar you get a dry wine.
The other main control mechanism for the fermentation is acidity.
Additionally, if after the largest part of the fermentation, the yeast is not completely removed from the wine, the fermentation will continue at a very slow speed, making your wine fizzy if bottled in this state.
Sometimes, wine does rot and the cork gets to smell just as horrible as the wine does. Do not worry, the wine is absolutely horrible and is in no way drinkable. It is impossible to mistake it for something "still ok to consume" :)