A lot of discussions pin everything on his love for Lily, and yeah, that's the big one. But Snape's motivations always felt more layered to me, less purely noble. The protection was a grotesque penance, sure, but I think it was also about reclaiming some twisted form of agency. After being forced to play double agent, after causing Lily's death, safeguarding Harry was the one thread of the plan he could still control. It was his own private, miserable vow.
Honestly, I don't even think he liked doing it most of the time. The loathing he felt for James's son was real, and the protection was a constant reminder of his own failure. The motive wasn't just love; it was a cage built from that love. Every time he sneered at Harry but still stepped in, he was locking himself in deeper. In the end, it was less about protecting the boy and more about meticulously, painfully, finishing the sentence he'd imposed on himself.