Just like to put my thoughts out on Snape (And no, I'm not going to bother to shrink the text: this is rather late in the thread, and if you haven't read the book and don't want any surprises, you really don't belong in this thread anyway):
I think that ever since he turned spy for Dumbledore before Harry's parents were killed, he's been playing both sides. He heard the prophecy, and decided that his master might not be so invincible as he had once thought. A rather powerful wizard in his own right, and seemingly very similar to Voldemort himself in many respects, he chose to find a way to save his own skin. He succeeded in convincing Voldemort of the utility of a spy in Dumbledore's ranks.
Then, Snape easily gained Dumbledore's trust (Dumbledore is a trusting person).
As for Snape's relationship with Harry, one only needs to look at his relationship with Harry's father. James and his friends were the best at everything. They were popular, good-looking, and got better grades. But Snape felt that he was the better wizard (not without reason: a young student who is making up his own spells and correcting a potions book? Quite impressive).
So, he entered into his relationship with Harry with the image of James in his mind: a showoff who really isn't nearly as good as he says he is. Thus, he can never see Harry do anything well. But that doesn't mean he wants to kill Harry. He wants to prove that Harry is a substandard wizard with no special powers or abilities. And the bad thing is, he's always succeeded in making Harry feel this way in his presence (hence Harry's inability to jinx Snape at the end of the book).
I'm willing to bet that what Snape is feeling at the end of the sixth book is that he will win no matter what happens. He knows that Harry has a chance to defeat Voldemort, but doesn't believe it really plausible. He sees Harry as inept, but has also seen that he seems to be blessed with a remarkable string of luck. But Snape wins either way: if Voldemort is gone, Snape may believe he has a chance of taking his place (or, at the very least, would then be free to choose his own life: the life of a Death Eater can hardly be called safe). If Harry is defeated he will feel that his beliefs on Harry's ineptitude will be seen by all, Snape's victory over James then complete.
Now, as for why he killed Dumbledore, I'd say that's because Snape is not a brave man. He is a Slytherin, and exemplefies all that there is to being a Slytherin: when the choice comes down to himself or anybody else, he'll choose himself every time. He likely did not know what he was getting into in the beginning of the book. It is very likely that he did it in an attempt to discover what Draco's mission was. It seems doubtful Voldemort would have confided in Snape, given what we know know of Voldemort's personality (he has no friends).
So while I don't think Snape is "all bad," that is to say, he's not as evil as Voldemort, he is still going to be wholly and completely Harry's opponent in the seventh book. By the actions at the end of the Sixth book, he is forced to be completely in the Death Eater camp, and won't betray his master unless he is absolutely and completely certain that he, Snape, will come out ahead. And he certainly won't betray his master to Harry, whom he seeks to denigrate.