Most tourist visas are subject to the “90 in 180 days rule.” This means that while your visa is valid for a period of 180 days, and while you can come and go as often as you like, you can only be in Turkey for a total of 90 days during any 180-day period.
Based on the European "Schengen Visa"
The Turkish visa is based on the "Schengen" visa. The Schengen countries are European countries which do not require a visa for visitors from the other countries involved. However, a foreigner who is not a citizen of one of the Schengen countries must have a "Schengen Visa." It is from the Schengen Visa that the 90-in-180 days rule originates.
"Counting Back" to Be Sure You're in Compliance
To know if you have exceeded your 90 days, you must "count back" 180 days. If the total time of your stay in Turkey has not exceeded 90 days in the previous 180 days, then you may remain in Turkey until you reach a total of 90 days in the previous 180 days.
Let's say it's October 1st. You want to know how much time you have on your visa. Count back 180 days from October 1st (you can use the date calculator under "External Links". You will see the date 180 days previously was April 4th.
Next, look at the entry and exit stamps on the pages of your passport to determine your total number of days in Turkey on and after April 4th (you can use the date calculator for that also). It doesn't matter how many times you have come and gone from Turkey, you just need the total number of days in Turkey.
Take that number and subtract it from 180. The result is the number of days you may remain in Turkey.
Important: The 180 days is a "moving" 180-day period, so on any date you do this calculation, it always concerns the previous 180 day period.
If You Want to Stay in Turkey for More than 90 Days in any 180-day Period
If you want to stay in Turkey for more than 90 days in any 180 day period, you cannot extend your visa. You must apply for a residence permit.
An Exception to the Rule
If you have reached a total of 90 days in Turkey on your 180-day visa, and leave Turkey, you can re-enter only if you pledge, on a form in writing, to apply for a residence permit within 10 days. This is done on a şartlı girişi (conditional entry) form that you will be given by border control personnel when you re-enter Turkey. Then you must complete your online application within those ten days.
There are several websites which offer visa calculators, as well as applications for smart phones which can help you be sure you're in compliance. Check "External Links" below for a link to an online calculator. You can also visit your smart phone's applications store and search for "Schengen Visa Calculator."
Turkey's E-visa Application System: The site where you can apply for an e-visa, or at least find out if you are eligible for one.
Calculator of travel days remaining under a Schengen short-stay visa: You can use this calculator by entering your visa validity period and how many days you have been in Turkey, to determine how many days remain before you overstay.