Why we value democracy? What is it in this process that we think it is good when it's there and is bas when it isn't? Why we think democracy is better than monarchy, for example?
If you think about it, one answer could be - because democracy tends to possess some features we find valuable and necessary, such as respect for the rights and freedoms of people that we consider basic and unalienable, personal security from arbitrary prosecution by the government, orderly transition of power, general participation of the population in the political process, not inhibited by government restrictions, etc.
Now if you look at what happens in Gaza with Hamas, you will find very little of that. Personal rights are not respected, government is a bunch of armed thugs ruling with iron fist and violently suppressing any dissent and any competing movement (it helps little that those are another bunch of armed thugs), and in general almost no benefit of democracy except the ability to vote for whoever is already in power is available to the citizens. If this is not a failure, what is?
However, if we look into the matter even more, I'm not sure there was democratic election involved at the first place. Political fate of Gaza was decided in 2007 in violent clashes between Fatah and Hamas, and Fatah lost. It would probably have lost also if the elections were fully democratic, but what actually happened and the process that led Hamas to assume power in Gaza had almost nothing to do with democracy.