The Roth IRA withdrawal order in practice

Why contributions come out first, and how that order affects a partial withdrawal.