Cows were found (along with goats, sheep, pigs and horses) in the Fertile crescent, around the time when agriculture developed there– between -10 000 to -4000. Both settled farmers and nomads had cows, and of course they wanted to maximise the amount of calories they could have to sustain their existence and thus milked their animals – not only the cows.
I'm sure that if you have a look in these sources, you'll find some more compelling theories into specifically how it happened. I'm fairly sure it'll be speculation based on either thought experiments or some vaguely associated inscription, if that's even something that exists. Maybe it does in parallel developments in other places.
Melinda A. Zeder, Daniel G. Bradley, Eve Emshwiller, Bruce D. Smith (2006) Documenting Domestication: New Genetic and Archaeological Paradigms
Melinda A. Zeder (2008) Domestication and early agriculture in the Mediterranean Basin: Origins, diffusion, and impact
http://en.wikipedia.org/wiki/Fertile_Crescent#Climate_and_bio-diversity
http://en.wikipedia.org/wiki/History_of_agriculture
Edit: Milking cows make a lot of sense tho. Once a calf dies on a cow (of natural causes), she's gonna be in discomfort from the buildup of milk in her udders. Taking that off her helps both you and your beast. And the more you do that, the more things you learn about things you can do with milk – sour milk, cream, cheese. You can even make alcohol:
The pastoral Scythians were not used to drinking wine—"their favored intoxicants were hashish and fermented mare's milk"[7]—and they drank themselves into a stupor. (from a famous anecdote of Herodotus: http://en.wikipedia.org/wiki/Tomyris) King Cyrus of the Persians used the unfamiliarity of his enemies with alcohol to defeat them, leaving a camp full of wine unguarded and attacking them during their hangover.
I imagine there's a lot to be learned about such practices from mythology. For Indian Hindus, the cow is holy – and I reckon Hinduism shares a lot with the ancient religions of Sumer and Akkad (even though the structuralism of Lévi-Strauss is out of style) in how it's used to legitimise our domination of the beasts. Greek mythology has a great story about how offering the bones to the gods and eating the flesh yourself makes sense (the story of Prometheus, see below). It stands to reason similar stories exist for the drinking of milk, and that they both have older origins than their ancient Greek or Hindu wrapping that you might be able to find more easily than the Sumerian version.
PROMETHEUS was the Titan god of forethought and crafty counsel who was entrusted with the task of moulding mankind out of clay. His attempts to better the lives of his creation brought him into direct conflict with Zeus. Firstly he tricked the gods out of the best portion of the sacrificial feast, acquiring the meat for the feasting of man. Then, when Zeus withheld fire, he stole it from heaven and delivered it to mortal kind hidden inside a fennel-stalk. As punishment for these rebellious acts, Zeus ordered the creation of Pandora (the first woman) as a means to deliver misfortune into the house of man, or as a way to cheat mankind of the company of the good spirits. Prometheus meanwhile, was arrested and bound to a stake on Mount Kaukasos where an eagle was set to feed upon his ever-regenerating liver (or, some say, heart). Generations later the great hero Herakles came along and released the old Titan from his torture.
There was a BBC radio episode on milk just a couple days ago! It has a little bit on our evolution and history, as well as more current news.
The relationship between humans and milk is a long and complicated one. We were never supposed to drink it past infancy yet we can’t seem to leave it alone. This week, we hear how an ability to drink milk forged the course of our evolution.
Plus, milk is big business. We hear how Dutch farmers are bracing themselves for the potential impact of EU milk quotas being lifted this year. And, why Coca-Cola has its eyes set on entering the milk market with a high-protein version. We find out about the unique social and economic factors that lead to the widespread pasteurisation of milk in the early 20th Century. And, Angela Saini talks to a farmer about the controversial trend of going back to drinking raw milk.