If I had a nickle for every time I've heard, "Mom, why did (s)he do that?" I would be a wealthy, wealthy woman. I have complained sometimes that I spend half my life trying to explain the obvious (Why do people greet each other when they meet?), and the other half trying to explain the unknowable (Why did that toddler pick the green lollipop instead of the orange one?). And strangely, the two seem to overlap with disconcerting regularity (Why did a stranger stick his gum on the bottom of my chair?).
Unfortunately for me, attempting to explain the world to someone for whom the world frequently makes no logical sense doesn't pay in nickles. Fortunately, however, it does pay in other ways. I have gained some valuable insights from both observing human behavior more closely than I otherwise would have, and pondering the meanings, motivations, and consequences of that behavior. Believe me, even the most seemingly mundane action performed by the most seemingly ordinary person can have layers of meaning and motivation that most of us will never guess at--and if you're watching closely, you might catch glimpses beneath the surface. As behavioral therapists are fond of saying, "All behavior is communication." Everything a person does says something about the person--about what's important to her, about his past, about what he wants from her, or how she values herself relative to others. It's fascinating to watch, and guess, and wonder.
The strategy I've found to be most effective in answering, for my son, that real-life question, "Why did (s)he do that?" is to say, "Since I can't know for sure what's happening in another person's mind, I can only guess. But here are some reasons I can think of that someone might do a thing like that." And then I list as many possibilities as I can think of, and encourage my son to do the same. Then I will point out some contextual clues I can see, and tell him which possibility I think is most likely the true one based on the clues. It has become a sort of game between us, and although some of our postulations can sometimes become pretty silly and far-fetched, I think the exercise has helped improve my son's ability to imagine the world from someone else's perspective.
And that's what fiction writers do, really, isn't it? We imagine another perspective, and we write it down. That sensation of being able to see inside another mind and actually know why (s)he did that--something that none of us can actually do in real life--is one of the things that most draws readers into the story. A character's motivations don't always need to be spelled out in detail on the page; sometimes it's best merely to hint at them and let the reader fit the pieces together and guess based on the contextual clues. But even when the motivations aren't specifically spelled out on the page, if theauthor knows what motivates a character, it's easier to make the character's actions seem consistent throughout the story and to make the character feel like a real, whole person (or alien, or fantastical creature, or y'know...whatever).
My challenge to you, dear reader, whether you're a writer or not, is to spend some time watching people. Take a notebook with you, and write down a specific action that you observe, in as much detail as you're able, including any contextual clues you might notice. Then write down as many possible reasons as you can think of that this particular person might have performed that specific action. Begin with the most obvious reasons you can think of, and then let your list grow into the realm of the outrageous. Maybe he's on the run from the mafia. Maybe she's an alien scientist sent here to learn how to mimic human behavior, but she doesn't quite have it right yet. Maybe you'll generate some really good story ideas in the process.
(And if you want a really eye-opening experience, spend an afternoon with an autistic person of your acquaintance, and ask him or her to point out to you things people do that don't make sense. I guarantee, you'll find it fascinating.)