Snape became a teacher to protect Harry and as penance for Lily's death
-----------------------------------------------------------------------

Snape felt terribly guilty of his own role in Lily's death. Dumbledore made use of that guilt, and made him promise to protect Harry Potter. Therefore he became a teacher at Hogwarts, because he had to be close to Harry in order to protect him.

> “If you loved Lily Evans, if you truly loved her, then your way
> forward is clear.” Snape seemed to peer through a haze of pain, and
> Dumbledore’s words appeared to take a long time to reach him.
>
> 
> “You know how and why she died. Make sure it was not in vain. **Help me
> protect Lily’s son**.”
>
> 
>
> 
> 
> There was a long pause, and slowly Snape regained control of himself,
> mastered his own breathing. At last he said, “**Very well**. Very well.
> But never – never tell, Dumbledore! This must be between us! Swear it!
> I cannot bear…especially Potter’s son…I want your word!”
>
><sub>*-Harry Potter and the Deathly Hallows*</sub>


----------
Since Voldemort was ultimately responsible for Lily's death, Snape joined the Order of the Phoenix, and in order to be active in the cause against the Dark Lord, he needed a credible excuse to be in contact with the headmaster. Teaching proved to be a good cover, since Voldemort never realized Snape's betrayal until his death.