To introduce the character Severus Snape seems redundant to me, as I would gather most know of the Harry Potter series, whether or not they've read the books or seen the movies or not. For those who don't, Snape is a major character in the Harry Potter saga, that's based on the novels of the same name by J.K. Rowling. As I've done both, I'll be mainly focusing on the movies, as I got acquainted with that medium first.
Now let's get to it. When I think back on when I first encountered Snape via the screen, I for sure disliked how he treated his or some of the students and how he was obviously hostile towards Harry Potter - the main character - but I was still wondering where his allegiance lied. Yes, it didn't help his case that he was acting suspicious or that he was in the vicinity where weird things were happening, but the same could've been said about Harry and his friends, which Snape also pointed out.
And further down the road we got a glimpse into Snape's past. When he first encountered Lily Potter (née Evans) - Harry's deceased mother - and how they soon became friends. Also how Snape met James Potter - Harry's deceased father - and his band of friends and how Snape had gotten bullied by them and when Snape insulted Lily (his only friend at the time) by calling her a mudblood. Then fast-forward a few years and we see Snape joining Voldemort - the main villain of the series - and him making the wrong decisions, like telling Voldemort about the prophecy of a child that would be the demise of Voldemort.
And though it was out of love that he had asked Voldemort to spare Lily's life, his request was self serving, as he didn't concern himself with her innocent infant. He only thought of her. But the turning point in Snape's story was when he went to Dumbledore - Harry's headmaster - after Lily had died and asked for his help. All was lost to Snape because Lily was all he had to live for. Dumbledore then requested Snape to be a double spy and made clear that when the time came Snape had to make choices, that he possibly might not agree with. Snape then pledged his allegiance for the cause against Voldemort.
Back to the main story of Harry Potter, where a few events occur, wherein Snape plays a major role that saves Harry Potter and also helps Potter and his friends in their quest against Voldemort. Yes, he made the wrong choices before, he was self serving and he aligned himself to a cause - that of Voldemort - that brought destruction and death. To some, those actions are unforgiveable, but I look at it from the bigger picture and look at what Snape did in the end and how his last deeds helped further the cause. Also his feelings for Lily might have been unhealthy, even tend to obsession, but those were the driving factors that made him help Harry until his end. Even if it were from the shadows.