All through the Harry Potter series, an invisibility cloak plays an important part in the story. It is given to Harry as an anonymous Christmas gift in his first year at Hogwarts. It turns out that it was Dumbledore who gave it to him; but that it had belonged to Harry’s father, James. Not until the last book do we learn how and why the cloak came to be in Dumbledore’s possession in the first place. The cloak also turns out to be more unique than Harry and his friends have hitherto realized, in spite of the fact that it has been of immense help to them through seven years.
In an essay I wrote between the sixth and the seventh book, i.e. before any of us readers knew the full story about the invisibility cloak, I made these notes:
The cloak is a mantle, which also belongs to the royal insignia [along with the sceptre=the wand, the crown=the Sorting Hat and the Goblet of Fire – three other objects that also “chose” Harry, rather than he them]. Among the Thirteen Treasures of Britain, we find, as the thirteenth object, “The mantle of [king] Arthur; whosoever was beneath it could see everything, while no one could see him.”
The Invisibility Cloak, I think, should be considered as a kind of opposite of Voldemort’s new body after his rebirth in the cauldron in The Goblet of Fire. This new body is in itself not much more than a Horcrux, since it is not really his own, but is made up of “Bone of the father, unknowingly given,” “Flesh of the servant, willingly given,” and “Blood of the enemy, forcibly taken”. When he rises again from the cauldron, he says: “Robe me”. Voldemort has chosen to become visible and tangible again. The Emperor puts on new clothes but cannot see that in spite of all his royal attire, his scattered soul is still vulnerable.
While Voldemort chooses to become Visible, Harry often chooses to become Invisible by help of his magic cloak.
The idea of the Invisibility Cloak goes even further back than King Arthur. I believe it is connected to the Biblical idea of the Cloak of Righteousness:
I delight greatly in the LORD;
my soul rejoices in my God.
For he has clothed me with garments of salvation and arrayed me in a robe of his righteousness - Isaiah 61:10
In Christian theology, the robe of righteousness is traditionally interpreted as the righteousness of Christ covering our sins and protecting us (the soul if not the body) from evil.
In the Harry Potter story there are many possible layers of interpretation; I believe the author herself is very conscious of them. Harry is in one sense a saviour, but at the same time he is only human. He is a Wizard, but from part Muggle background. The cloak came to him from his Father; and also from Dumbledore who is a sort of father-figure to him (and to all of the students at Hogwarts). The cloak is given to Harry (not initially earned) and it protects him and enables him to fulfill what he must fulfill. It protects not only him, but also his friends.