Let us consider a sample patent family lifecycle, beginning in 2009.
1 Jan 2009: Provisional application PROV1 is filed.
A provisional doesn't really have a term, since it never becomes a patent. However, after 12 months it is no longer useful for claiming priority/benefit. We can therefore say it expires after 12 months (on 1 Jan 2010).
PROV1 therefore (sort of) expires on 1 Jan 2010.
1 Jan 2010: Non-provisional application US1 is filed claiming the benefit of PROV1.
A US non-provisional application has a term of 20 years (35 USC § 154(a)(2)) from its own filing date. It is irrelevant whether it claims the benefit of PROV1 (35 USC § 154(a)(3)).
US1 therefore expires on 1 Jan 2030 (20 years from filing of US1).
1 Jan 2010: PCT application WO1 is filed claiming priority to PROV1.
A PCT application doesn't really have a term, since it never becomes a patent. However, after 31 months from its earliest priority claim (excluding that some countries allow late entry into national phase), it is no longer useful for filing applications in specific countries.
WO1 therefore (sort of) expires on 1 Jul 2012 (31 months from filing of PROV1).
1 Jul 2011: US national phase application WO1-US is filed from WO1.
A national phase application has a term of 20 years from the date on which the corresponding PCT application was filed (35 USC § 154(a)(2) — reference to applications under section 365(c)).
WO1-US therefore expires on 1 Jan 2030 (20 years from filing of WO1).
This demonstrates that a US non-provisional application (such as US1) claiming the benefit of a provisional application has the same expiry date as a US national phase entry (such as WO1-US) from a PCT application claiming priority to that provisional. In other words, whether the US non-provisional is filed 12 months after the provisional or 30 months after the provisional (via a PCT) is irrelevant for term.
1 Jan 2012: Continuation US1-CON is filed from US1.
A continuation (or continuation-in-part or divisional) has a term of 20 years from the date of the earliest application to which it claims benefit (35 USC § 154(a)(2) — reference to applications under section 120 and 121).
US1-CON therefore expires on 1 Jan 2030 (20 years from filing of US1).
1 Jan 2013: Continuation WO1-US-CON is filed from WO1-US.
WO1-US-CON therefore expires on 1 Jan 2030 (20 years from the effective filing date of WO1-US, which is the filing date of WO1).
What about abandonment?
Each application proceeds separately. That is, if you abandon one, it doesn't affect the term of the others. The only catch is that a continuation must be filed while the preceding application is pending.
Patent term adjustment
All the above scenarios have proceeded on the basis of a 20 year term. However, in some cases, the patent term may be extended beyond this 20 year term if prosecution takes inordinately long (35 USC § 154(b)), potentially up to a few years. While the calculations for patent term adjustment are beyond the scope of his question, this adjustment is, in any case, noted on the front page of the patent publication.
Conversely, the maximum patent term may be shorter than 20 years if the applicant files a terminal disclaimer (35 USC § 253). This is typically done to avoid (judicially-created) double patenting based on an earlier-dated patent.
This can be explained vaguely through an example. An inventor owns a patent P1 for a particular invention. They then file a patent application P2 for a similar subject matter, such that there is some overlap between P1 and P2. Since P2 is filed later, P2 would effectively extend the patent term for that invention beyond 20 years. This double patenting is not allowed.
In order to avoid this, the application may file a terminal disclaimer. This gives up the additional term on P2 (such that P1 and P2 have the same term), thereby avoiding the double patenting.
So how do I calculate the dates?
The USPTO provides a patent term calculator which prompts for the necessary data and calculates the expiry date. It is accurate even for pre-1995 patents (for which the rules were somewhat different).