Introduction
The idea
that hot water could freeze before cold water seems
counter-intuitive, yet it has been seen in many experiments
investigating the effects as well as by many people at home and over
several hundred years. The effect has yet to be fully explained and
many scientists still disagree about what causes the effect. There
is a lot of history behind the effect and it was argued upon by many
scientists over the years, and probably still today. However, had it
not been for a young Tanzanian schoolboy, the effect might have been
left to remain in the history books.
History
The western world has known about the Mpemba effect for a long time, although it is only in more recent years that it has been known by this name. Aristotle noticed the effects and wrote the following around 350BC:

"If water has been previously heated, this contributes to the
rapidity with which it freezes: for it cools more quickly. (Thus so many people when they want to cool water quickly first stand it in
the sun: and the inhabitants of Pontus when they encamp on the ice
to fish. . . pour hot water on their rods because it freezes
quicker, using the ice like solder to fix their rods.) And water
that condenses in the air in warm districts and seasons gets hot
quickly. " - Aristotle, Meteorologica,
trans. H. D. P. Lee (Harvard University Press, London, 1962), Book
I, Chapter XII, p.85-7.
In the 13th century Roger Bacon wrote also noted the effects and wrote about them in Opus Major. What's interesting about his observations, is that he had realised that the effect can only be seen in some circumstances and that one must specify precisely the experimental conditions under which the effect was seen.
Later on, the effect was noted by Giovanni Marliani in around 1461
and in 1637 Descartes wrote about it in Les Meteores.
However, not everyone believed the effect was true. In fact, many
simply dismissed the experiments which showed the effect as mistakes
because the results contradicted what was known about heat. In the
20th Century the effect was brought to light in 1963 by a Tanzanian
secondary school student by the name of Erasto Mpemba. who
discovered the phenomenon whilst making ice-cream.
The Mpemba Effect
Whilst making ice-cream at school with fellow students, Erasto Mpemba placed a hot mixture for making ice-cream into a refrigerator even though he was supposed to wait for it to cool. He placed his mixture next to that of a student that had not used boiling milk whilst rushing to ensure that he would get his into the fridge before space had run out. Later on when he returned, he noticed that his mixture had frozen first.
When he asked his teacher about what he had seen his teacher that said he must have been confused and that it couldn't freeze faster. However, Mpemba decided to do his own experiments with both milk and water and continued to see similar results. When a professor from a nearby university, Dr. Osborne, came to visit the school, Mpemba questioned him about what he had seen. At the time, he was unable to give an explanation for the effect but when he returned to the university he asked one of the technicians to try the experiment and report the results.
"The technician reported that the water that started hot did indeed freeze first and added in a moment of unscientific enthusiasm ‘But we'll keep on repeating the experiment until we get the right result’ ” - E. B. Mpemba and D. G. Osborne, "Cool?," Phys. Educ.4, 172-175 (1969).
When Dr. Osborne continued to get similar results, he and Mpemba
together published the paper from which the above quote is taken.
When this was published in New Scientist, readers began to
write in in support of this claim with other stories.
Theories
Environmental Factors
There have been many attempts to explain the Mpemba effect, yet there is still no accepted theory. Initially, some common suggestions argued that the container in which the warm water was kept would melt the layer of frost (a common occurrence back then) and eventually re-freeze forming a layer of ice between the glass the fridge. They claimed that this would allow the warm water to have better thermal conductivity than the cold water. However, modern experiments in frost-free freezers prove that, while this could have an effect in a freezer which has frost, it is not the sole reason behind it.
Heat Transfer
Another suggestion is that of heat-transfer. Since the rate at which heat moves from one place to another is proportional to the difference in temperature, it has been suggested that since there is a greater temperature gradient in the warm water, it transfers heat quicker. An addition to this suggestion is that the warm water loses part of it's mass due to evaporation and thus there is less mass to cool. However, experiments with closed containers proved the latter idea could not be the only reason, although it could be a contributing factor.
Supercooling
A more recent idea is one of supercooling. Recent research shows that, because water can freeze at a variety of temperatures, it's possible that the warm water would have a higher freezing point and would begin freezing first. However, this doesn't necessarily mean it would freeze completely first.
Convection and Solutes
A recent paper by Professor Katz from Washington University proposes an idea which combines two previous alternatives. One is that of convection currents and the other the presence of solutes on the water. His theory suggests that both these together cause the effect to happen.

Figure 1
In figure one, we see how a glass of cold water typically freezes. Ice first appears on the surface, followed by the bottom and sides. This has two effects, first, the surface of water is no longer in contact with the open air. This prevents heat loss through evaporation. The second effect is that as the water freezes, the solutes in the water move toward the unfrozen part, a process known as zone refining. Because of this, the unfrozen water begins to have an increasing concentration of solutes which lowers the freezing point of the water.

Figure 2
In figure two we see the process of hot water freezing. In the warm
water, there are convection currents which move heat from the bottom
of the glass to the top. At the top, energy is used up as some of
the water evaporates. Because of the rising heat, the warm water
doesn't form the layer of ice on the top from the start. This allows
the convection currents to continue to draw heat to the surface
where it is used up as the water evaporates. Also, the warm water
has lost some solutes whose solubility decreases with increasing
temperature, due to the heating process. Thus the concentration of
solutes is less than the cold water. So, the odds are stacked against the cold water. It has an increasing concentration of solutes as the water freezes and the process of conducting heat away from the water is hindered by the formation of ice which surround the water. In the warm water however, there are less solutes to begin with and convection currents carry heat to the surface. Could this be the reason behind this effect? I contacted Prof. Katz to find out if he had any result back from his suggested experiments, unfortunately, he had nothing to report. So all we can do is wait....
Conclusion
"At first sight, the question
is quite simple: “Does hot water freeze faster
than cold?” However, a little thought shows that this formulation is
not adequate. Clearly, a small drop of hot water can freeze faster
than a cold ocean. Hot water in a freezer will freeze faster than
cold water on a warm day (as the latter will not freeze at all).
These examples are silly, but illustrate the need to state the
question clearly. A better second attempt at stating the problem
might be “Given two bodies of water, which are identical in all 5
parameters (mass, shape, surroundings, etc. . .), except that one is
initially at a higher uniform temperature than the other, the hotter
water will freeze first.” But further thought shows that this cannot
be correct. If the initially hotter water is at 99.9999°C, and the
initially colder water is at 0.0001°C, then the initially cold water
is just seconds away from freezing, and it is clear that the hot
water cannot possibly overtake it." - Monwhea Jeng
The quote above sums up very well the reason why it is so difficult to find a solution to the problem. This is because the question allows for such a wide range of parameters and this in turn leads to a wide variety of results. So, in order to answer the question, you first need to define it specifically. However, any experiments to prove this would only be valid for that set of parameters. So, there doesn't appear to be any fundamental reason that this effect occurs, however this does explain why so many people have had such different results!
References
Hot water can freeze faster than cold?!? - Monwhea Jeng
When hot water freezes before cold - J. I. Katz