This page is referenced in:
Also called "maintenance fees", since December 12, 1980, all utility patents filed with the USPTO are subject to renewal fees. These fees are due 3.5, 5.5 and 11.5 years from the date of the patent grant. 
There are seperate fee schedules for patent-holders that can claim 'small-entity status' and late fees.  If a fee is not paid the patent expires after a six month grace period (and can only be paid up to six months in advance). However, a patent may be restored up to two years after the expiration of the grace period if the patent-holder can successfully claim that non-payment was unintentional or at any time until the end of the statutory term if non-payment was unavoidable.
Wikipedia claims that patents filed under the Patent Cooperation treaty are not subject to renewal fees. But the source does not back this claim. 
Prior to Section 532(a)(1) of the Uruguay Round Agreements Act, enacted on June 8, 1995, patents had a term of 17 years from granting. Subsequent to this date they had a term of 20 years from application.
Note that these calculations ignore priority date, the (rare) cases where a patent's term is disclaimed, and the (very rare) cases when all of the claims of a patent are cancelled during a re-examination.
- If a patent was filed before 12th December 1980 (~1981), it has a 17 year term from granting and wasn't subject to renewal and couldn't be granted additional time for processing delays, etc.
- If a patent was filed after 12th December 1980 but before 8th June 1995 (~1995) patents could be renewed 3 times to a full term of 17 years from granting.
- A patent filed after 8th June 1995 a patent could be renewed 3 times to a full term of 20 years from application.
- A patent filed after 29th May 2000 was eligible for Patent Term Adjustment provisions of 35 U.S.C. § 154(b). The average patent term adjustment is now approximately 600 days. In 2005 it was approximately 200 days.  However, this will not affect the calculation of patent expirations until 2020.
Letting last renewal number R = 1,2,3, and renewal to full term F = 0,1, I will therefore be using the following rules of thumb:
- appyear < 1981, expyear = gyear + 17
- 1981 <= appyear <= 1995, expyear = gyear + 4*R + 5*F
- 1995 < appyear <= 2020, expyear = appyear + 4*R + 8*F
In the cases when I don't have data on renewals for a patent filed after 1980, I will assume renewal to full term. The vast majority of these data points will be for patents that haven't yet had to renew (a first/second/third time). Thus they are valid beyond the end of my sample.