First, here's an important sidenote: only girl cows can produce milk. I'm sure that just completely changed the way you think about nature. :) Therefore, for a dairy farm, cows are the queens. Heifers, or females that haven't calved yet, are princesses. The profitability of a dairy farm relies on females' milk production. When a cow gives birth to a female, that female calf will likely eventually end up giving milk herself.
To increase the odds of having a female offspring, many farmers choose to artificially inseminate with sexed semen. This technology was developed in 1989 by scientists with the United States Department of Agriculture, and it has been readily available since the early 1990's.
So, just how can you sort something you can't even see? Well, scientists inject a dye into the sperm collection. It's fluorescent, and it sticks to the DNA in an amount proportional to the number of X and Y chromosomes in the sperm. X chromosomes (females) contain more DNA than Y chromosomes (males), so more dye sticks to the sperm cells that are carrying female chromosomes.
Next, the sperm cells are sorted. A laser lights up the dye, and the sperm gives off light proportional to its DNA content. The X sperm always glowers brighter, because it's carrying more DNA. The sperm is sorted into two different batches, allowing it to be packaged into doses according to the probable sex of offspring it will produce.
Species from cattle to rabbits to sheep to pigs have benefitted from this technology. On our farm, sexed semen has allowed us to produce more heifer offspring, which will enter our herd and eventually produce milk. It has increased our efficiency and allowed for a consistent supply of heifers. Does the stork really have anything to do with it? No. Science? Absolutely.