Why does milk curdle?

Milk is a mixture (called an emulsion) of several compounds, primarily fat, protein and water.
The three components of the emulsion separate when milk is heated; curdled milk is the result of
the milk proteins coagulating and separating from the water.
The small protein molecules in milk typically float around freely and independently because the
protein is suspended in a colloidal solution. Milk appears white because of the light-refracting
properties of these floating protein molecules. Normally these protein molecules repel each
other, allowing them to float about without clumping; when pH levels drop in milk, it turns
acidic and milk protein (casein) molecules attract one another to form “curdles” or lump. The
lumps then float on the solution's surface. At higher temperatures, the lumps form more rapidly.
The Science of Curdled Milk
Acidifying milk — essentially lowering its pH — causes the milk proteins, like casein, to
unwind and unfold in a process known as protein denaturing. The unfolded proteins are then
free to interact with each other and clump together in a way they could not do when they were
properly folded. The protein clusters that are combining together give the milk a curdled
appearance.
Spoiled Milk
Bacteria are present in all milk, including pasteurised milk. Bacteria happily live their lives while
consuming lactose, a type of natural sugar found in milk. Several byproducts, including lactic
acid, are produced as a result of the digestion of lactose. The pH drops and the casein molecules
start to clump when the milk's lactic acid starts to rise. High levels of lactic acid are also
responsible for the distinctively sour smell of spoiled milk.
Curdled milk is a sign of spoilage, but not all curdled milk is unsafe to consume. One of the
many causes of milk curdling is when it is mixed with vinegar or lemon juice for a recipe or
when it is added to highly acidic coffee or tea. In these cases, consuming curdled milk is safe.
Make sure the milk was not initially curdled.