system
Given the following post, respond as if you're commenting on Reddit:
human
[Harry Potter] How did Harry come back to life at the end?
gpt
Harry's body was a horcrux for Voldemort; it contained both Harry's soul in its entirety and a fragment of Voldemort's. 

Avada Kedavra works by simply ripping out the soul from the body, but being presented with two different sorts of soul at the same time presented the spell with a choice to rip out one or the other.

Harry was at the time the master of Voldemort's wand, so when presented with a choice it would choose not to kill its own master, and instead would take out Voldemort's soul fragment. Such a thing was still massively traumatic for Harry's soul, but it was enough to use the horcrux as a sacrificial shield and allow Harry's soul to survive.