Seize upon contradictions. Readers like Tom Sawyer, for example, because of his mischievous but fundamentally good nature. (Reference 3) Though Humbert Humbert in "Lolita" is a man who appreciates beauty, he often finds himself living in sordid circumstances; his attempts to justify his decisions reveal the depths of his personality.
Avoid black and white portrayals of good and evil. The title character in "Macbeth" is often considered one of Shakespeare's most compelling characters because he fits the roles of hero and villain. While Macbeth initially appears to be a heroic warrior, Shakespeare later shows him committing grisly murders. His grief at his wife's death genuinely overwhelms him, however, making it difficult to consider him merely a heartless killer. (Reference 4)
Steal from real life. Borrow the traits of historical figures for your characters, as Robert Penn Warren did in "All the King's Men" when he based Willie Stark on Huey Long, the Depression-era governor of Louisiana. Or simply put your friends into your novels like Jack Kerouac did in "On the Road," "The Dharma Bums" and others works. (References 5 and 6)
Learn the lessons of motivation from psychology. Characters should do things for a reason. T.S. Eliot objected to the main character's actions in "Hamlet" because nothing accounts for Hamlet's grief. On the other hand, recognize that sometimes no motivation makes for the best motivation. Samuel Taylor Coleridge called another Shakespearean character, Iago, the Machiavellian ensign in "Othello," "a motiveless malignity."