When we do learn the truth about Snape, that he protected Harry out of guilt for Lily's death, which he was more-or-less the cause of, we still find it hard to sympathize with him, because after all, none of what he did was for Harry's benefit, really. It was because of a promise he made to Dumbledore, in the wake of the guilt of what he did. And that makes him a rather unlikable fellow to us, because we identify with Harry. He's the main character, and it's from his point of view in which the events of the story unfold. However, I urge you to try and look at it from another perspective:
Life has been unkind to Severus Snape every. Single. Step. Of. The. Way.
Few details have been confirmed about his childhood, but he was bullied relentlessly. His family was poor, and his father was not a kind man. He came to school in the hopes of finally having a friend to call his own, but his torment at the hands of James, Sirius, Lupin and Pettigrew caused this very lonely boy to shut himself in. This is generally where people point out that he called Lily a mudblood. How many of us have ever said anything in anger that we didn't mean? I know I am guilty of it. Even though it's a horribly offensive word, I doubt he meant it. Lily was his first real friend, and he had begun to develop romantic feelings for her, only to be humiliated in front of her, and many others.
When he tried to apologize, Lily won't listen. Now Snape's Mistake has created a huge rift between he, and the woman he loves.
Assuming that Snape is anything like most men, he probably thought that he had to do something impressive to win Lily back. He knew he was no good at Quidditch or other sports, so he could not compete with James in that aspect, so he threw himself into potions and spells, and yes, the Dark Arts.
To draw an example from another popular fantasy series, Anikan Skywalker tangoed with the Dark Side of the Force to save the one he loves. Love can make people do ridiculous things, and the type of obsessive love that Snape was experiencing caused him to become a death eater.
Obsessive love because Lily was one of the very few who had ever shown him any type of kindness or respect, which for someone like Snape, who grew up in an environment like he did, was much like feeding a starving dog. In his fervor, he accidentally bit the hand that was feeding him, and lost Lily in the process. He turned to the Death Eaters for solace, I imagine. Here again, he had "friends", or people who understood him, at least. He felt wanted, again.
And then, Lily married James. The one person he hated more than anyone else. Hated because James picked on him, hated because James had always had almost everything Snape wanted: A happy childhood, friends, a good family life, money, talent, good looks, and now, he had Lily.
In his despair, it was likely that he thought his best course of action was to go to Voldemort with the information he learned from eavesdropping on Dumbledore and Trelawny. Perhaps Voldemort would only kill the boy... kill James... but spare Lily. How many of us would willingly sacrifice an unknown child, and a person we loathed, if it meant we could save the one we loved?
When he learned that Voldemort had bypassed all the protection, and his own personal pleas for Lilly's life, he was sick with grief.
He promised Albus that he would help Harry. For Lily.
When Harry arrived at Hogwarts, imagine what that must have been like for Snape, a child who looked so like the man he loathed, and had -literally- wished dead. A Child who would be a constant reminder of what he lost... and Lily's preference for another man. Although it was not fair to Harry, Snape judged him right then and there, and pronounced him JUST LIKE HIS FATHER. It may not have been right, but I can understand why he did it. How many of us have ever misjudged someone based on their looks?
Snape's biggest mistake where Harry was concerned was that he was never interested in getting beyond his perception. All he could think about were the mistakes he had made where Lily was concerned, how much he hated himself for her death, and how much James had hurt him in the past. I'm not saying he's right; quite the opposite, I'm simply saying, "I understand."
Snape was hard on his students, Harry in particular, but also those associated with Harry, because it likely reminded him of James, Sirius, and "the gang". But overall, he was stated to be a good teacher, and a gifted wizard. Harry was unable to get value from Snape's teachings because of how Snape treated him, and his personal feelings towards Snape (as a result of his treatment). However, when that treatment is taken out of the equation (with the introduction of the Prince's potions book), you see what a good teacher and good wizard Snape truly was, beneath his anguish and brooding.
Snape then goes "undercover" at Dumbledore's behest. This is difficult and dangerous work, for there are few wizards so gifted at Occulemecy(sp) that they could block out a Wizard as talented as Voldemort. He had to be quick witted to be able to lie smoothly when put on the spot, and he had to be exceptionally brave to keep close company with Bat-Crap-Crazy Bellatrix, who would Avada-Kedavra him as soon as look at him, and the Dark Lord, who was not know for his tolerance, either. He was forced to kill a man he admired, and considered a friend, when Dumbledore was cornered on the astronomy tower.
That weighed heavily on his mind in the months that followed. When Voldemort took over the ministry, and named Snape the headmaster of Hogwarts, he did everything in his power to keep the students within as safe as he could, while still not blowing his cover. He could not prevent all the wrong doing that was occurring, because that would raise suspicion. He had to remain close to Voldemort for as long as he could, to help Harry as much as he could, without alerting Voldemort to his actions, all with 90% of the student body and many of the teachers fighting him every step of the way.
Imagine what Hogwarts would have been like if Delores Umbridge were given free reign over the students again... or someone worse, like Bellatrix LeStrange. Harry pointed out to Ron that the punishments given, like detention with Hagrid, were no worse than what they endured when they were at Hogwarts. I don't foresee Bellatrix doing something so slight.
The hardest part for most Anti-Snapes to swallow is how all of the sudden, after the Battle of Hogwarts, Harry suddenly forgave Snape for everything. I don't think there was anything "sudden" about it. Harry makes his speech to his son, who is 11, 19 years after the events of "that night" when he learned the truth about Snape.
Which means, he had seven or eight years to process what he learned before he named his son. I think in all time, Harry was able to understand that although Snape had never treated him with Kindness, he had done what he could to protect him. He had made the ultimate sacrifice to achieve a goal they were both working towards. He understood the parallels between his own life and upbringing, and Snape's, he was able to forgive Snape for his cruelty, because he understood. He understood that his father, James, wasn't a golden child, perfect in every way, and that everyone shared guilt in what happened, to varying degrees. Harry also knew that there was no sense in holding a grudge against a dead man.
Though Snape had almost never been kind to him, he had loved Lily, and Lily was a part of Harry.
It was probably hard for Harry to reconcile at first, but imagine in sever or eight years, he managed it. So, in summary, do I agree with Snape's actions and his treatment of other characters? Not always.
Can I understand and empathize with him? Yes.
We've all good light and dark in us, after all