For example, the cows I own I can keep on my land and they are perfectly content to munch grass around the different pastures throughout the year as they are rotated, and have free clean shelter in the barn and free hay in the winter. The only thing containing them is a thin strand of wire which they can (and have) easily walked through at any point in time without even trying, usually to reach an especially tall clump of weeds on the other side. For most of their life they are under basically zero stress due to protections from the environment and predators and have no desire to leave or look for more. They don't feel trapped and keeping them contained is more of a suggestion that they don't wander off and get lost. While at the end it sucks they will be distressed when loaded up in a trailer and taken down the road to the slaughterhouse, but they aren't thinking "Oh my god they are going to kill and eat me!",they are just bewildered by the wild experience of being driven down a road in a trailer, then let out in a new place with maybe some other cows around, and are instantly KOed when they are to be slaughtered.
I would have very different feelings about it if they lived in shitty life trapped in a little cage always hoping and trying to find a way out, feared humans as they came around stealing their friends away from them at random times assuming they were being eaten. And I do feel that way about, and don't buy, a lot of factory meat for the contained caged lives they experience when there are known better, healthier, more sustainable, and more ethical ways of caring for farm animals that goes back thousands of years.