I am a much bigger Angel fan than Buffy fan but I have seen most episodes of Buffy and I am wondering, when she was in the hell dimension with Angel and killed him, how did he later escape and still have his soul after his escape?
Unfortunately, this is never totally explained.
Season 2 ends with Buffy sending the re-souled Angel into Acathla's Hell dimension. Season 3 picks up with Angelus mysteriously being returned, with no explanation.
Over the course of the first half of the season, Angel begins to worry that he was sent back for some greater, possibly sinister purpose. This is somewhat confirmed in Amends (S03E10) when The First Evil claims that it was responsible for Angel's return with the purpose of driving him to change back into Angelus and kill Buffy.
This claim is never fully substantiated, and given how often The First lies, it is possible that it was lying about this as well.
From the transcript (note: Jenny is actually The First)
Jenny: You want her?
Angel: (panting) No.
Jenny: (insistently) Take her. Take what you want. Pour all that frustration and all that guilt into her, and you'll be free.
Jenny: You can't live for eternity with all that pain. This is what you are. This is why we brought you back. Take her! And then you'll be ready... (moves in to his ear) ...to kill her.