Was it only the circumstances or really great diplomacy behind this? Or both? What was the "secret"?
To just resurrect an anwser from before that I gave:
Well technically Turkey didn't. Through much of the war, Turkey was trading with both sides, and actually signed a non-Aggression pact with Germany just prior to Barbarossa, but relations deteriorated with the Axis, and Turkey declared war in February, 1945.
Both sides were pretty much OK with Turkey's neutrality early on. Germany obviously wanted to secure their flank against Turkey possibly joining the Allies, and the in the early years, the Allies were fine with it since it would prevent Germany from sweeping into the Middle East from that direction, meaning one less front to defend for them. The Western Allies though started pressing Turkey to come and join them though, stepping it up heavily in 1943. At the very least it was hoped that Turkey would render more material aid, and stop trading with the Axis. Best case scenario, Churchill wanted them to join the war to attack the Balkans.
The Soviets however were seen as a threat to Turkey, and wasn't part of this pressure. Stalin had even expressed a desire for Turkish territory, or violating Turkish neutrality. This actually helped push them into the Allied camp though, since appeasing the US and UK would obviously put Turkey under their protection in the case of Soviet aggression. So by mid-1944, Turkey was pretty much pro-Allies, and cut of diplomatic relations with the Axis. Turkey knew a winner when she was one, and in a mostly symbolic gesture by that point, officially declared war in early 1945. I don't believe that Turkish troops saw combat (I could be wrong though), and the main effect of this was Turkey's early involvement in the UN (founding member) and NATO (joined 3 years after creation).