For the dairy industry to thrive, it only needs females, as males do not produce milk.
Like all mammals, a cow produces milk to feed her young. The notion that cows produce milk all the time is misguided, as they only do so when they have a cub.
For this reason, males are slaughtered after birth. Either this will happen immediately, or they will be sold to the meat industry, where they will be killed as calves after a few weeks of captivity, or as adult cattle as soon as they reach a profitable size, which will be around one year old.
If a cow gives birth to a female, the latter will usually be separated from the mother so that the mother’s milk can be seized, after which she will be abused in the same way. When breast milk becomes less profitable, her neck is cut.
This usually happens after two cycles of milking when the cow is about six years old. The average lifespan of cows is twenty years.