For me, it is always the characters who have depth to them, who are not purely good or evil but know they make mistakes and surprise me with what they come out with sometimes. When I first started writing about my rebellious fairy godmother, Eileen, I had not planned initially that she had a good relationship in childhood and early adulthood with the Chief Witch, who went on to create the havoc Eileen is fighting against at the time of The Trouble With Mother.
But I am glad I came out with that. Eileen shows she is not biased against someone just because they are a witch. The Witch shows she was capable of getting on with others different to her too. I can then explore what went wrong (and indeed do so).
So do you know your characters as well as you think you do? What surprises are they capable of unleashing on you as their creator as well as on the other characters in the story? How do they develop? How can you show them learning from their mistakes?