Deepavali or Diwali is perhaps the most popular of all the Hindu  festivals, bringing joy to the young and old all alike. It is widely celebrated  throughout India,  though with regional variations, and among the Hindus settled abroad. It may be  called the Queen of All Festivals as it contains the seeds of Indian Strength  which is unity in diversity, inclusiveness and core human values. Looked at  from any angle – as festivities, as legends and as philosophy – this festival  occupies a pride of place in Hindu culture. Diwali is a vrata and an utsava at  the same time. Let us have a peek into its heart and find out what constitutes  it to be what it is.
AS A FESTIVAL
It is very difficult to trace the origin and development of this  festival. It is stated to be already well-known festival by the time of the Bhavishyottara Purana said to have been  composed before 1000 A.D. Diwali is generally a celebration spread over five  days. It falls during the last part of October and early November.
The first day is Aswin Krishna Trayoadasi which is called Dhanteras, also known as Dhantrayodasi or Dhanwantari  Trayodasi. On Dhanteras Goddess Laxmi is worshiped to provide prosperity and well  being. Hence Dhan Teras holds a lot more significance for the business  community.
A legend says that once the sixteen year old son of King Hima was doomed to die by a  snake-bite on the fourth day of his marriage as per his horoscope. On that particular  fourth day of his marriage his young wife did not allow him to sleep. She laid  all the ornaments and lots of gold and silver coins in a big heap at the  entrance of her husband's room and lighted innumerable lamps all over the place  and went on telling stories and singing songs.   When Yama, the god of Death arrived there in the guise of a serpent his  eyes got blinded by the dazzle of those brilliant lights and he could not enter  the Prince's chamber. So he climbed on top of the heap of the ornaments and  coins and sat there whole night listening to the melodious songs. In the  morning he quietly went away. Thus the young wife saved her husband from the  clutches of death. Since then this day of Dhanteras came to be known as the day  of "Yamadeepdaan"and lamps  are kept burning throughout the night in reverence to Yama. 
According to another legend, during the Amrit Manthan when the gods and  demons were churning the ocean for Amrit or nectar, Dhanavantri (the physician  of the gods and an incarnation of Vishnu) emerged carrying a jar of the elixir  on the day of Dhanteras. 
On Dhanteras Day Hindus consider it auspicious to purchase gold or silver  articles or at least one or two new utensils. It is believed that new “Dhan” or  some form of precious metal is a sign of good luck. "Laxmi-Puja" is  performed in the evenings when tiny Diyas of clay are lighted to drive away the  shadows of evil spirits. 
In villages cattle are adorned and worshiped by farmers as they form the  main source of their income and are supposed to be the incarnation of Goddess  Lakshmi.
The second day is Narak Chaturdasi. The legend behind this day is very well known for the killing of  the demon Narakasura.  Narakasura ruled  the kingdom of Pragjyotishpur. Puranas have it that Naraka, son of Bhudevi, acquired immense power from  a blessing given by Lord Brahma after a severe penance. Under his rule, the  villagers suffered a lot of hardship as the demon tortured the people and  kidnapped the women to be imprisoned in his palace with his invincible  might.  Unable to bear the tyranny of the  demon, the celestial beings pleaded with Lord Krishna to save them from his  torture. But Naraka had a boon that he would face death only at the hands of  his mother Bhudevi. So, Krishna asked his wife  Sathyabhama, the reincarnation of Bhudevi, to be his charioteer in the battle  with Naraka.  When Krishna  fell unconscious after being hit by an arrow of Naraka, Sathyabhama took up the  arms and killed Naraka.
At the request  of Bhudevi, the mother of the slain demon Naraka, his death is not treated as a  day of mourning but an occasion to celebrate and rejoice. It is said Lord  Krishna had an oil bath to rid himself off the blood spattered on his body when  Naraka was killed.
Since then the custom of taking oil-bath (Abhyangan) before sunrise on this day  has become a traditional practice. It is customary in the South to enquire one  another whether he had Ganga Snaan meaning thereby whether he had oil-bath or  Abhyangan.
The third day of Diwali festival is the most important one for Lakshmi-puja and is entirely devoted to the propitiation of Goddess Lakshmi. Despite  the fact that this day falls on an Amavasya day it is regarded as the most  auspicious.
Lakshmi Pooja, or the worship of the goddess of wealth, is the main event  on Diwali in North and West India. It is  extremely important to keep the house spotlessly clean and pure on Diwali.  Goddess Lakshmi likes cleanliness, and she will visit the cleanest house first.  Lakshmi Puja consists of a combined puja of five deities: Ganesha is worshiped at the beginning of every auspicious act as Vighnaharta; Goddess Lakshmi is worshiped in her three forms - Mahalakshmi (the goddess of wealth and money), Mahasaraswati (the goddess of books and  learning), and Mahakali; Kuber (the treasurer of the  gods) is also worshiped.
The fourth day, the day following the Amavasya, is "Kartik Shuddh  Padwa" and it is only on this day that the King Bali would  come out of Pathal Loka and rule Bhulok as per the boon given by Lord Vishnu.  Hence, it is also known as ‘Bali Padyami’ or ‘Balipratipada’. This day is also called ‘Dyuta  Pratipada’. ‘Dyuta’ means gambling. It seems that on this day Parvati defeated  Sankara in a game of dice and that she became very happy whereas Sankara was  distraught and sulking with sorrow. This scene is shown in the Ellora Cave  No.21. Hence those that win in the gambling on this day are expected to be  happy throughout the year and the opposite being the case with those who lose.  The natural human urge to gamble fortified with this legend and sanctioned in  Brahmapurana make people even today to indulge in gambling recklessly to their  hearts’ content on this day. In some places gambling with cards  is common and reaches its peak on the night of Diwali. According to Dr.P.V.Kane’s  ‘History of Dharmasastra’(Vol.V, pt.1, p.203), the stakes soared up to three  million rupees in a small country like Nepal in 1955 on the Balipratipada  day.
This day also marks the coronation of King Vikramaditya and Vikaram-Samvat was started from this Padwa day.  It is customary for people to visit each  other and offer New Year greetings by saying ‘Naye Varsh ki hardik Shubh  Kaamnayein’.
Govardhan-Puja is also performed in the North on this day. Govardhan is a small  hillock in Braj, near Mathura  and on this day of Diwali people build hillocks with cow dung, decorate them  with flowers and then worship them. This festival is in commemoration of the  lifting of Mount Govardhan by Krishna. As per Vishnu-Puran the  people of Gokul used to celebrate a festival in honor of Lord Indra and  worshiped him after the end of every monsoon season but one particular year the  young Krishna stopped them from offering  prayers to Lord Indra who in terrific anger sent a deluge to submerge Gokul. People were  afraid that the downpour was a result of their neglect of Indra. But Krishna assured them that no harm would befall them. He  lifted Mount Govardhan with his little finger and  sheltered men and animals from the rain. This gave him the epithet Govardhandhari. After this, Indra accepted the supremacy of Krishna. 
This day is also observed as Annakoot meaning mountain of food. Pious  people keep awake the whole night and cook fifty-six or 108 different types of  food for the bhog (the offering of food) to Krishna.  In temples especially in Mathura  and Nathadwara, the deities are bathed in milk, dressed in shining attires with  ornaments of dazzling precious stones. After the prayers and traditional  worship innumerable varieties of delicious sweets are ceremoniously raised in  the form of a mountain before the deities as "Bhog" and then the devotees approach the Mountain of Food and take Prasad from  it