There are many stories about the tradition of celebrating Maha Shivaratri. After Samundra Manthan, Lord Shiva drank poison then went to the Himalayas to meditate. After the demons knew that powerful nectar was found , demons tried to steal it from the Gods because they wanted to be more powerful than the Gods and destroy and take over the heaven. After severe battles between the Gods and demons ( virtue and evils) Devas or Gods became able to defeat the demons because victory is always with the good or truth and they received gift of immortality- the nectar. Drinking the poison, Lord Shiva sacrificed himself for the safety of his universe and this is the remembrance of that day.
Another version of the story is this: After the creation of the world, Parvati asked Lord Shiva which devotees and rituals pleased him the most. The Lord replied that the 14th night of the new moon, in the dark fortnight during the month of Phalgun, is his most favorite day. Parvati repeated these words to her friends, from whom the word spread over all creation. Since then Shivaratri is being observed by Hindus across the globe.