Shakespeare's attempt to create sympathy for Claudius
serves two purposes. First, Shakespeare refers in several of his
plays to the two sides that exist in everyone, a person's ability
to be good or evil. In showing this repentent guilt in
Claudius, Shakespeare acknowledges this existence. Claudius is
afraid of God's punishment for his evil deeds, so he attempts to
pray one more time, seeking God's salvation for his crime.
This makes Claudius more believable as a human being.
This brings us to Shakespeare's second reason for allowing us
to see Claudius as a more sympathetic character. Hamlet sees
Claudius praying, and Hamlet realizes he must postpone killing
Claudius. If he murders him while at prayer, Claudius will go to
heaven rather than hell. Hamlet vows to kill him while the king is
"about some act/That has no relish of salvation in't--...".
What Hamlet doesn't realize is if he had waited for a few seconds,
he could have killed Claudius because he still hadn't
been able to pray, and Claudius gets up as Hamlet leaves.