The beginning of the end for the Ottomans was in 1683 when they failed to take Vienna and by 1800 the Russians, Austria-Hungarians, and Napoleon's French were at the country's borders. Soon, the people under Ottoman rule began gaining independence from the ethnic Greeks to the ethnic Serbians as the Ottomans failed to take what the industrial revolution offered and fell behind Europe socially, economically, and infrastructurally.
In 1908 the Ottoman Sultan was forced to abdicate by the "Young Turks," which was a group of western-looking liberals, later led by Mustafa Kemel Ataturk, who sought a secular country. This movement was the most significant recent shift in making Turkey what it is today. After WWI, in which Turkey sided with the losing side, Turkey was born out of the chaos of encroaching nations and the leadership and unity of the people under Ataturk's rule.
Ataturk was a strong leader who gave the country modern industry and a quickly advancing economy, however he also sought a nation built on ethnic Turks so the Armenians, Kurds, and Greeks were treated as second rate citizens and have described his rule as everything from cruel to genocide, yet most Turks see his rule as the golden age of modern Turkey.
After WWII, which Turkey almost wholly avoided, the country found a close ally in the United States, who wanted to secure the Turkish border with the USSR. In the rest of the 20th century, Turkey was faced with an instable government and other political issues, but never so far as to threaten the nation's growth or stability. Perhaps the largest economic problem facing Turkey during this period was their out of control inflation, forcing the country to adopt a re-valued Lira in 2005.