Basically when Voldemort used the Avada Kadavara curse to kill Harry, he only killed the part of himself(the horcrux he created the night he tried to kill Harry the first time), so it left Harry's spirit in tact, while killing only the part of Voldemort. Here's a bit more explanation:
According to Harry Potter Wikia:
In Harry Potter & The Goblet of Fire, Peter Pettigrew used Harry Potter's blood as part of the ritual to create a body for Voldemort. Thus, part of Harry's life - his blood - existed within Voldemort. Note this scene from The Goblet of Fire, Chapter 35: "Veritaserum":
When Harry told of Wormtail piercing his arm with the dagger, however, Sirius let out a vehement exclamation and Dumbledore stood up so quickly that Harry started. Dumbledore walked around the desk and told Harry to stretch out his arm. Harry showed them both the place where his robes were torn and the cut beneath them.
"He said my blood would make him stronger than if he'd used someone else's," Harry told Dumbledore. "He said the protection my - my mother left in me - he'd have it too. And he was right - he could touch me without hurting himself, he touched my face."
For a fleeting instant, Harry thought he saw a gleam of something like triumph in Dumbledore's eyes.
The reason for that gleam of triumph in Dumbledore's eyes was that he knew Harry now had a bit of life insurance. So long as Voldemort was alive, Harry would have something that anchored him to life - his own blood.
In other words, Voldemort was tied to life through his horcruxes: bits of Voldemort's soul living outside his body where they would not be killed if he were killed, providing Voldemort with an anchor to Earth. And Harry was tied to life through his own blood, blood which was infused with his mother's protective, love-based magic, which existed outside of Harry's own body and would not be killed when Harry was killed, providing Harry with an anchor to Earth.
Dumbledore explains this to Harry in Harry Potter & The Deathly Hallows, Chapter 35: "King's Cross."
He took your blood and rebuilt his living body with it! Your blood in his veins, Harry, Lily’s protection inside both of you! He tethered you to life while he lives!”
Therefore, when Voldemort used the Avada Kedavra curse on Harry, the only soul he managed to kill was the tiny piece of his soul which Voldemort had unknowingly implanted in Harry on 31 October, 1981, the first time he attempted to kill Harry. Because that accidental horcrux in Harry's forehead was a foreign object, not tied to Harry's own life, it could be killed, and was killed, while Harry's own soul remained tethered to life.