Instinct/genetics, trial n error & lots of reading/seeking help from forums, I'd say.
I learn best by jumping in & doing. If I fail, fine. If I succeed, great.
My aunt raised sheep & had an orchard, but they weren't animal people, so not anyone I took any advice from. When I visited during 8th grade, she had a dog & 3 wool sheep left. Neither were actually cared for, toss food/water in & otherwise ignored. Already knew as a kid, this wasn't right.
Grandmother raised nutria a long time ago, but again, Polish people aren't known for their kindness towards animals nor people different than themselves, so I didn't ask her either.
My parents only had pets because it is part of "the American dream" or whatever.