When you write a book, and most especially a series of books, you get to know your characters almost like you know yourself. They come alive and (unbidden as many times as bidden) will sit on your shoulder or walk along beside you while they tell you their stories, or they will visit your dreams, guiding you to a better, but mostly subconscious understanding of their world. Through these interactions with them, you learn their fears, their joys, their triumphs. The pretty, the ugly, and everything in-between can and will arise and you then get to see another piece or two of their psyche so as to deepen your understanding of who they are and what their place is in your overall narrative.
It is a compelling and intimate process that has no match in real life. I mean, you can't actually get inside another person's head, identify their conflicts (or the roots of same), become privy to their most private thoughts, or fully comprehend every one of their motivations. Honestly, it is truly quite frustrating that you can't do that when you're used to enjoying exactly that kind of connection to the characters in your fictional life.
More satisfyingly, as part of the art of writing you have the opportunity to explore the myriad possibilities of personalities in general and in specific, to analyze potential whys and wherefores in reasonings for choices made or maybe for paths not walked, to take what you note about real people and do some critical thinking in your fictional world about just how they became who they are, then taking those potentialities and seeing which of your characters have these same qualities. The real beauty of that is that it's accomplished by an intrinsic process, so there is little to no conscious work attached to it. But all this analysis helps to flesh out your protagonists, other main characters and, of course, your villains.
I wish I could say that it also helps you to understand people in the real world, but it does not. As luck would have it though, it does help you to understand yourself much, much better than ever before. It can also serve to help you maintain a positive progression in your work.
Now, I have to admit that all of this has nothing to do with anything other than it is marvelous to me what the power of imagination can do.