The main ritual of Hanukah is candle lighting. We light up the candles as a form of advertising the miracle of Hanukah.
Why don't we advertise the miracle otherwise? Why are we lighting candles?
One of the daily rituals at the Temple was lighting up the Menorah. Unlike the Hanukah Menorah (called 'Hanukiya' in Hebrew), the Menorah at the Temple had seven candles - one in the middle, three on each side. The Hanukiya has nine - four on each side, one in the middle.
The ritual of lighting up the Menorah was carried out by the most senior priest, the Cohen Gadol (there was only one Cohen holding this position). Lighting up the Menorah required an extra virgin olive oil; the extraction of the oil was being carried out by people who had prepared themselves spiritually for the production process. The oil would then be kept in sealed jars in a pure and holy environment until it was used for lighting up the Menorah.
A jar that was found unsealed was considered contaminated and not suitable for lighting up the Menorah.
The Greeks were very much aware of the importance of the rituals held at the Temple. In order to devastate the Jews, they have savagely vandalized the Temple so the Jews won't be able to carry out the holy rituals. One of the things they did was to break the entire inventory of jars of pure extra virgin olive oil.
When the Maccabies - the rebels who fought the Greeks - managed to win the battle over Jerusalem and take over the Temple, the first thing they had in mind was to clean up the Temple and restore the holy rituals. As they were cleaning up the Temple, they found out there was no pure olive oil for the Menorah.
They searched very carefully until they found one little jar that survived; it was sealed as required. Miraculously, the oil in that jar lasted 8 days - until a new shipment of oil arrived at the Temple.
Evil is considered darkness. Light is a symbol of purity, righteousness , goodness. We light up candles to commemorate the miracle of the little oil that lasted eight days, the victory of spirituality over materialism, good over bad.
We position the Hanukiya by the door - preferably just outside the door - or at the window where it can be seen by the people out on the street. Positioning the Hanukiya so it can be seen from the darkness of the streets is also a way of saying that we wish to project light and goodness and spirituality on places where it is dark and bad and unfriendly and bring ‘light’ to those ‘dark’ places.