Regarding the beginnings of decline of the Ottoman empire, let me quote this from Yahya Armajani from his book - 'Middle East past and present' (p158):
"The vitality of the Ottoman state depended upon warfare and its economy was based on loot and tribute from the conquered nations. Because of both the rise in power of the nations of Europe and Asia and of the long distances involved, military conquests became more expensive and more difficult. By the end of the sixteenth century, conquests had virtually stopped, and the army became restless in having to perform defensive duties. The whole machinery of government, which was oiled and fueled by war, gradually came to a grinding halt. The process of decay took some 300 years, but the signs had already appeared in the seventeenth century."
I suspect part of the decay of the Ottoman Empire was that the "Timar system" that the Ottomans used for military, administrative, and fiscal structure could only take them so far, and once they seized to expand it no longer was effective.
Of course, by the 16th and 17th centuries, Western Europe had already begun to surpass the rest of the world rather rapidly in scientific and military technology, Western Europe and America were becoming epicenters of world civilization.
It seems to be much of the various groups in the empire remained complacent and weak and this allowed the Ottomans to carry on much longer than they should have.