In general, direct contributions are taken out first, followed by conversions, followed by earnings. (For the exact rules, including more details on withdrawal ordering of conversions I'd recommend researching Roth IRA withdrawal ordering. Note that the rules for accounts like Roth 401k are different.)
Direct contributions are not subject to tax or penalty when withdrawn, so if one can always withdraw their total direct contributions without tax or penalty from a Roth IRA, while leaving earnings in the account. Withdrawing taxable portions of conversions or earnings may result in tax and/or a 10% penalty, depending on ones circumstances.
Once you reach the correct age, money coming out of a Roth IRA is not taxed. Money coming out of a traditional IRA is taxed.
As GP noted, contributions to a Roth IRA may be withdrawn at any time without penalty or taxes. The gains from those contributions follow different rules however.
E.g. Suppose you put in $1000 to a new Roth IRA account with no other contributions. Suppose the account is worth $1500 today. You may withdraw the $1000 you put in with no penalties or taxes leaving $500 in the account.
I'm saying, the law doesn't care that you left the part you over contributed uninvested, and that it was some other money in the account that grew.
I'm saying, to avoid penalty, you have to withdraw (direct contributions first) equal to [excess * (current value/value at date of excess contribution)].
This amount could be higher or lower than what you contributed, depending on how the existing Roth IRA investments in the account changed in value between the time of excess contribution and the withdrawal.
The original post is saying that some people may discover they've contributed too much to their IRA after doing the tax calculations (say, if they just contribute the max $6k now).
If this happens, you're subject to a 6% penalty unless you withdraw the excess along with "net attributable" earnings. These earnings are subject to the 10% early withdrawal penalty in addition to the normal income tax, and are calculated as a prorated portion of the entire IRA growth.
Kind of a big if for any retirement account right now unfortunately. But yeah, you would only pay a 10% early distribution penalty on any gains.