why is 年 sometimes pronounced as ネン and sometimes as とし? Can someone explain this?
It's not only 年. There are two ways (systems) to read any kanji, and often more than one possible reading under each system. The two systems are called Onyomi (which originated from the Chinese pronunciation of that character), and Kunyomi (how Japan chose to pronounce the character). You can read more about the topic in this lesson given by HelpfulDuo:
and also here: