Every mitzvah has its measure. The quantity of matzoh that should be eaten; the size of the sukkah; the squareness of tefilin.
The lighting of the Chanukah candles also has its measure, regulated by the same rabbinical tradition that created the mitzvah itself in the time of the Hasmoneans back in the second century, B.C.E. The custom to light in the doorway or the window; to light at sundown; to begin with one candle on the first night, adding a candle each night until we have eight---all are measures of the mitzvah, parameters of the will of G-d, that have come down to us through the Sages.
In most cases, if one does not conform to the measure of the mitzvah---too little matzoh was eaten, the sukkah was too tall or the tefilin not perfectly square---one has not fulfilled the mitzvah. All the good intentions in the world will not help, if the practical execution is lacking. It has been compared to an electrical circuit. One break in the circuit, no matter how small, and nothing happens. Likewise, the capacity of a mitzvah object or action to conduct the blessing of the Creator into this material world can only be utilized if the mitzvah is complete. Otherwise, it is an exercise in futility.
Chanukah should be no exception. There is a requirement that the candles burn for at least half an hour after sunset. If the supply of oil or wax is deficient (and it's advisable to check with a rabbinical authority, and not rely on package labels), and the candle will not burn long enough, the mitzvah has gone unfulfilled, and eating more latkes won't help, either.
Nevertheless, we encounter here a curiosity of the halacha: If the candle had sufficient capacity to burn at the time of kindling, even if, in the end, it was extinguished by a sudden gust of wind or some other unforeseen factor, one is not required to re-light it to complete the duration of burning! Certainly, it is proper to re-light the candle if it did go out before the prescribed time. But one is not obligated to do so. As long as the candles were prepared correctly, and everything that reasonably needed to be done had been done to ensure the completion of the mitzvah, you can go on singing Maoz Tsur with a clear conscience.
Of course, this does not mean that it is acceptable to place the candles in a windy spot, where they can be expected to be blown out right after they're lit. That's not called doing your best. There has to be a reasonable expectation that they will burn for the full half hour. But if the unforeseen happens, and the lights go out, no one can point a finger at you, accusing you of not doing your Chanukah duty.
Since every mitzvah, including those of rabbinical origin, is an expression of the will of G-d, it is fair to inquire into the meaning of such an anomaly. What is it that G-d wants---or doesn't want---of us in the mitzvah of the lighting of the Chanukah candles?
For the answer to our question we must draw upon a proper understanding of one of the most fundamental---and least understood---concepts in Judaism: what is usually termed Providence. That is to say, that not only does Judaism posit that G-d was the Creator of the world, but that the ongoing existence of the world and everything in it is also an expression of the Divine Will. Whatever happens---or doesn't happen---is only because G-d wills it.
This means that the success or failure of any human act depends not on the actor, but on the Will of G-d. Everything from the outcome of the war in Afghanistan to the ability to spin a dreidel or chew a latke is circumscribed by Providence. In most cases, of course, our bodies obey us in carrying out their everyday functions at the brain's command. Only when something fails to function are we reminded that our lives are not in our control.
The free will of the human being---without which there can be no meaning to any system of reward and punishment---on which the Jewish world-view is also founded, is consequently far more limited than most people think. We are not really in control of the outcome of our actions; the actions themselves are dependent on a Higher Power. Rather, our free will consists primarily in our thoughts and intentions.
This halacha of Chanukah, that one fulfills the mitzvah of lighting as long as the proper effort was made in preparation, even if the candles did not in the end burn the full duration, represents the Jewish view that in life generally our responsibility is to make our decisions and act to carry them out; but if, in the end, the bright dream of success is extinguished, it does not mean we have failed. Our job is to decide and to act; success or failure is G-d's business.
Why should it be that Chanukah is the vehicle for teaching this lesson? For that we need look no farther than the miracle of the oil in the Chanukah story itself.
Upon re-taking the Temple, the Hasmoneans could find only one container of oil that retained the seal of the High Priest, ensuring that the contents had not been defiled by the Greeks. However, the oil was sufficient only for one day, and it would be another week before more pure oil could be brought. Although, under the circumstances, the letter of the law would have allowed for defiled oil to be used, the Hasmoneans understood that it would be improper to do so. The re-constitution of the Temple service, and the inauguration of a new era of spirituality, required the highest level of purity. So they proceeded to light with the one-day supply, not knowing where the rest would come from. The miracle of the oil burning for eight days became the basis of our eight-day festival of Chanukah for all the generations since.
When they made their decision, they did not know that there would be a miracle. They only knew that they had a responsibility to renew the Temple service in the best possible way. What would happen after that was G-d's business.
Likewise, in the lighting of the Chanukah candles, and in life in general, it is important to know that our job is to do the best we can. What the outcome will be is G-d's business.