In Thor: The Dark World, Thor, Loki and Jane are in the dark elves world.
Thor is in a fight and Loki saves him by impaling the foe with a blade. The enemy then grabs Loki and stabs him with the blade that's sticking out of his chest.
We see Loki die (or fake his death). Thor mourns for his brother and he and Jane leave leaving Loki on the ground.
Then at the end of the movie Thor is talking to Odin. He tells him he can't be the king of Asgard and leaves. After he leaves Odin turns into Loki revealing that Loki is still alive.
How did he fake his death? Was he actually stabbed and just performed the illusion that he stopped breathing until after Thor left?