I used to work on the Virgin Atlantic flights at Gatwick so am speaking from personal experience, and am sure other airlines work the same way. Management have a meeting in the morning and knowing a flight is overbooked in economy, decide how many passengers need to be upgraded to Premium Economy and how many Premium Economy passengers need to be upgraded to Upper Class. They don't wait until the very end of check in to do this, but tell the check in agents to "select" suitable passengers. The key is to arrive early, be nicely dressed and politely ask the check in agent if they are needing to upgrade anyone on the flight. Calling reservations the night before (to confirm your booking), ask the agent if this is a full flight so you know in advance if there is a chance of an upgrade. Happy flying!