Also, cows bred for their meet are slaughtered at 7-8 months of age. If cared for, a cow could live for 20 years, but economics prevail.
Cows held for their milk have it a bit better, as they get to live for 5-6 years. Also, things have improved. For example, the milking robot not only improved yield, but also allowed each cow to select the time it wanted to be milked, and does not require farmers to chase their cows towards their milking place two or three times a day.
Not kept in buildings: That depends on the level of industrialization of the farms and on the quality of your grassland. For example, in the Netherlands, mowing grass mechanically and feeding it to your cattle which is kept inside year round is the way to go, if you look at this purely economically (cows destroy too much grass by trampling it and by dropping cow peas on it)
Consequently, there is now talk of paying farmers to let their cows go out on the meadows.
Not in huge buildings? Go to https://www.google.nl/search?q=cow+stable+design and click on 'Images'. Fewer cows per stable than we do with pigs or chicken, but not small stables, either.
That's a very existential question that doesn't have an easy answer. Is a somewhat brief existence worse than no existence at all? If we eradicate fruit flies (or the many species that live short, brutish existences), have we done them a favor?
I am a huge fan of the Omnivore's Dilemma and recommend it wholeheartedly because while Pollan faces these serious questions, he doesn't simply resort to the easy answer.
This would apply to local farms perhaps, but from what I read industrial livestock production is causing suffering to many animals to lower the costs.
Disclaimer: I am not a vegan.