Milk is a complex compound containing fat and proteins (including casein). When you add vinegar to the milk, it causes the pH to drop, and the negatively charged casein begin to attract other molecules to form lumps. This is called coagulation. When the alkaline baking soda is added, this neutralises the acid, allowing the molecules to separate again.