How does Shakespeare use sin and salvation to add depth and meaning to Hamlet?
I think that yes, Shakespeare does use sin and salvation to add depth of meaning to Hamlet.
One could use the character Claudius as an example of this concept. In Act III after the play The Mousetrap, Claudius goes attempts to pray and ask for forgiveness for the murder of his brother. Yet because he cannot truly repent, which would require his willingness to give up those things he has gained through sin, his prayers cannot be heard; therefore his sin remains with him and salvation is lost to him.
Another example might be found in Old Hamlet, the ghost. When he first speaks with Hamlet, he tells him that he was murdered with "no shriving time given." What this means is that he was not given his last rites or an opportuntiy to pray for forgiveness of his sins before his death. For that reason, he must spend some time in purgatory or hell until he has paid for his sins and can recieve salvation from them.
A third example might be Hamlet and Leartes. In the final scene, after Leartes has poisoned Hamlet and then been poisoned by his own sword in the scuffle, the two confess their "sins" and exchange forgiveness.
LAERTES: He is justly served.(335)
It is a poison temper'd by himself.
Exchange forgiveness with me, noble Hamlet.
Mine and my father's death come not upon thee,
Nor thine on me!
[Dies.]HAMLET: Heaven make thee free of it! I follow thee.
Though this is not exactly last rites, it is a confession and repentance before death. With it, one might presume that Hamlet and Leartes are candidates for salvation.
The repentance for sin is one thing differentiates Leartes and Hamlet from Claudius.
On a related topic, see the second link below for an enotes page that discusses the theme of redemption in Hamlet.
Part of what makes Claudius's crime of killing King Hamlet (Prince Hamlet's father) heinous is that Claudius murdered King Hamlet when the king was in a state of sin. He had not confessed; he had not had his last rites; he was simply snoozing. This explains why King Hamlet must walk the earth, for a period, as a ghost. Claudius not only killed King Hamlet's body, but blocked his soul's passage to heaven.
This information helps drive the plot of the play. For instance, Hamlet will not kill Claudius when he sees him at his prayers, because he believes that would not truly count as revenge: Claudius would die in a state of salvation and grace, unlike his father. Ironically, what Hamlet can't know, although the audience does, is that while Claudius looks like he is at prayer, in fact, he is thinking about how he simply can't repent of his sin of murdering King Hamlet. Therefore, Hamlet could have killed him then and justice would have been served. Instead, Hamlet waits and kills Polonius by mistake.
Sin and salvation also play a role earlier in the play: Hamlet is concerned that the ghost may be an agent sent by Satan to deceive him into the sin of killing an innocent man. Hamlet doesn't want this stain on his soul, which is why he takes the time to find out if Claudius actually murdered his father.
Sin and salvation also play a role in why Hamlet doesn't commit suicide early in the play. He explains that he would if he could know he would merely dissolve into oblivion. However, he worries he might meet his Maker—and that encounter might not go well, because suicide is a sin, and because Hamlet worries he has not lived a blameless life. In other words, the afterlife might end up worse for Hamlet than this life as a depressed prince.
Revenge is not a Christian concept. Nevertheless, Shakespeare complicates the revenge drama by making Christian notions of sin and salvation central to this play.