Bored of your run-of-the-mill, Everyone Poops brand of self-celebrating children's stories? Well, Andersen's tales are pretty remarkable in that they dwell on about the darker side of being human: people sin, and darkness often lives in our hearts. Andersen's take on sin is simultaneously pretty standard for a Christian and pretty optimistic. He thinks that all humans are sinners and should live in fear of God, but he also keeps reinforcing the redemptive powers of love and faith. So many of Andersen's characters learn the error of their sinning ways, and finally make it up to heaven when they repent and beg for mercy… even though they know they don't deserve it. Cuz up until now, they've been kinda crappy people.
Andersen was obsessed with writing about sin because he feared that he was a sinful (hence unlovable) person.
Andersen was optimistic about redemption because, like any good Christian, he, too, wanted to go to heaven.