Of course developing a character is quite an intimate process. But still, like a story, you can in fact have some tools that give you some sort of axiomatic path on "how-to".
There is a TV writer named Shonda Rhimes. She has an interesting, but confusing, point of view about how she created a particular character. She said that for some characters she knows everything about their lives; for some others she knows almost nothing. Then, she said something quite curious: "I didn't know that character X was violent until that moment".
My question isn't about the particular process of hers; but rather about this "phenomena" that you (you as a writer, as a human being) can carry a character in your mind and suddenly you know something about her/his life (the character "tells you about him/herself). It seems that you have something "alive" in your mind.
Now, how can a creation of your mind (a character) do something that you don't imagine?
I suppose that when you read a book or consume some reference on how to develop a character and the author says something like "You must put your characters in situations to discover more about them", they're saying that your character must have some sort of "independent will, against the mind of their writer".