'For the last couple of weeks there were rumors to the effect that a large group of ranked officers in Turkish Armed Forces would be forced to retire by the end of summer. My guess is that last night's move was an organized attempt by this group of officers. The quite obvious lack of organization and inefficiency observed in the attempted coup can also be explained without resorting to conspiracy theories or theatricality of a staged ploy: The junta prepares for, or at least entertains the idea of a coup but somehow the news of the attempt is leaked and rumor gets around. Government learns about this. The disappearance of Erdoğan for the last week and the excitement of several foreign embassies in the last few days can also be attributed to these rumors. It is also quite possible that the government, with the comfort of being forewarned and realizing the limits of the junta, may have planned to turn this into an advantage and instrumentalize a potential coup for its own benefit. They may have also planned to catch all the junta in the act thus making it a more open and shut case.
Obviously the junta would know that its cover had been blown and in return they may have acted prematurely as a last resort, to save their asses and made the last night's gamble. I think, this is the most logical explanation of why the coup seemed like a farce.
As to the the aftermath, I think Erdoğan is most right when he frames this as a providence from God. This coup attempt could not have come at a better time. The u-turn in foreign policy, the admittance of failure in Syria, the great purge within the party, the issue of Syrian refugees all had brought the party esprit-de-corps to an all time low and alienated Erdoğan to his base. And as such, it provided Erdoğan a decisive victory in domestic politics. Now he is a victorious leader once again, a veteran. The people flooding the streets were also united in their leader's defense and this turned into an opportunity to overcome the alienation. Erdoğan will once again acquire the status of rightly-guided leader who is led and provided by by God. And of course there is no doubt that he will use this credit to utmost limits.
Kind of like the Auspicious Affair (Vaka-yı Hayriye) of 1826 whereby the Janissary corps were abolished once and for-all, this failed coup has a facet of auspiciousness. Yet, imagining the aftermath we can also predict that it will have several facets which will prove quite oppressive and burdensome for Turkish citizens.'