Milk curdles when mixed with vinegar because the acid from the vinegar causes the protein molecules in milk to come together to form visible solids.The solids float in the clear whey, forming curdled milk.
Milk primarily consists of protein, sugar and fat. Normally, the protein molecules in milk repel each other and they float separately in whey. Adding an acid, such as vinegar, increases the number of positively charged hydrogen molecules in the solution. These hydrogen molecules bind to the protein molecules, causing them to attract other protein molecules. When the protein molecules bind, they form curds, which float in the liquid whey.
Adding vinegar to milk is common in preparing cheese. Cheese recipes require warming the milk because curdling happens faster at warmer temperatures. When adding vinegar to milk to make a buttermilk substitute, however, using cold milk causes the milk to thicken and have a slightly acidic quality without fully curdling and separating the curds from the whey.
Milk curdles when its acidity increases for any reason. Thus, spoiled milk also curdles. This is because the metabolic processes that bacteria in milk undergo release lactic acid, and lactic acid increases the acidity of the milk, causing curd formation. Lemon juice also causes milk to curdle.