heres a theory courtesy of wikipedia (previously mentioned but in further detail)
There is also the possibility that Snape didn't 'turn bad' after all. He had no choice but to partake an 'Unbreakable Vow' with Narcissa, or else risk being unmasked by Bellatrix. He was thus bound by the vow to protect Draco and finish the task set upon Draco, if Draco failed to do it himself. The hatred mirrored in his face when he killed Dumbledore, was a hate directed at himself for having to do something he never wanted to do, not as Harry thought directed at Dumbledore. Dumbledore pleaded with Snape, but again unlike what Harry thought, he didn't plead for his life, but that Snape would do what was necessary, thus kill him. Dumbledore knew about the Unbreakable Vow and he immobilized Harry, so that there was no way that he would interfere, knowing that the most important thing was Harry's safety (this may also may have been what the argument between Dumbledore and Snape, which Hagrid overheard, was about). Still bound by the vow, Snape takes Draco and his mother, Narcissa, to a safe place and protects them, while he aids Harry, who doesn't know this, to find the last Horcruxes and destroys them. Snape and Harry will meet in Book Seven, and most probably Snape will find his death, possible through Harry, but not before Harry has found out the truth about Snape.
always possible, because I dont think Snape is evil, i mean we were led to believe throughout prisoner of azkaban that Sirius was evil, and it turned out he wasnt.