Hannah's poem is reminiscent of Mary's song in the New Testament. Both are contemplating relief from oppression through the eyes of motherhood. In Hannah's case, she had been scorned for her inability to bear a child and after the birth of Samuel she gushes with thanksgiving. Her words echo the Old Testament theme that God rewards the righteous and punishes the wicked. It does work that way sometimes, but the Bible has many variations on the theme. The Psalms contain rants of those who are discouraged and angry at God. The "all is vanity" approach taken by the book of Ecclesiastes is so similar to Buddhism that it is often suggested as a starting point for Christians to evangelize Buddhists. And even people who don't know the Bible are aware of the "patience of Job", an undisputedly righteous man who suffered extensively.
I suppose that the problem of suffering is the largest roadblock people face when trying to figure out what it means to follow Christ. When Jesus' disciples saw a blind man they asked whether it was the man himself or his parents who were being punished. Since the man had been blind from birth, if he were being punished then he would've had to have been reincarnated from some previous existence. Maybe the disciples were actually asking about karma. Who knows? But Jesus says that suffering is not always related to punishment. Then he makes a quite unusual observation. He says that within suffering the works of God can be displayed. (Cue Vestal Goodman belting out "I wouldn't take nothing for my journey now.") It's hard to understand, but we do have a model. Easter celebrates One who suffered, entered into death, and destroyed it by filling it with life.