I have a layover at Istanbul airport for 13 hours and flying from the USA to India. I want to leave the airport to visit Turkey. Do I need a transit visa for 13 hours?
UPDATE: Turkey is once again issuing e-visas to US citizens. If you are a US citizen you can obtain an e-visa in advance for US$20, or a visa-on-arrival for US$30.
You haven't stated your nationality, however given your route I'm going to presume you are either a US or Indian citizen.
If you are a US citizen, then currently it is extremely difficult to obtain a visa for Turkey. You will need to apply in advance at a Turkish Consulate, pay US$200, and only a limited number of visas are being issued. (There are a few other alternatives such as if you are a resident in another country, but even these are complex)
If you are an Indian citizen, you can obtain a visa in advance via the Turkish e-visa system. This will cost you $43 and will be valid for up to 6 months. You can also obtain a visa-on-arrival one you arrive in Turkey, however this will be more expensive, take extra time, and is generally not recommended.
Alternatively if you do not wish to enter Turkey then no visa is required to simply transit Turkey - presuming you are arriving in and departing from the same airport (there are 2 main airport in Istanbul - IST and SAW) - although 13 hours is a long time to spend in an airport (there is an air-side hotel to make the stay a little more pleasant, but it's not cheap!)