As others have mentioned, most U.S. airlines that operate multi-class aircraft have a system for upgrading frequent fliers with their airline into first class seats for free. To provide a concrete example, here's how Delta's system works:
Complimentary upgrades for elites are only allowed on flights that do not offer Delta's "DeltaOne" long-haul business class product. "DeltaOne" basically means anything with the lie-flat beds, unless those aircraft are being operated on short-haul routes for repositioning purposes or some such thing.
The system is entirely automated, so upgrades are processed by the computer rather than by the gate agent, removing the incentive to just throw whoever checked in last in the upgraded seat.
Any Medallion member who books a Y-class fare (full-fare economy) ticket is upgraded to First immediately at ticket purchase.
5 days before check-in opens for the flight (i.e. 6 days before departure,) anyone with Diamond or Platinum Medallion status will have their reservation automatically upgraded to first class.
3 days before check-in opens, Gold Medallions will be upgraded to First.
1 day before check-in opens, Silver Medallions will be upgraded to First.
However, only a certain number of First-class seats will be open for upgrade at a given time. If there are not enough open seats in First to upgrade everyone who is eligible at a given time (which is almost always the case,) upgrade priority is as follows:
Y fare class.
Highest status tier.
If status tier is equal, highest fare class purchased.
If both status tier and fare class are equal, whoever bought their ticket first.
If not all Medallion members have confirmed upgrades by the time of flight check-in, the remaining Medallion members will be ranked according to the above priority and, as seats are released for upgrade availability, they will have their upgrades confirmed in that order. The last few First class seats are usually released shortly before departure. Monitors in the gate area display the current upgrade list and Medallion members can also access it either on Delta's website or their mobile app after they check-in.
Note that the above process applies only for complimentary upgrades to First Class. Complimentary upgrades to their "Comfort+" (premium economy) product are available at time of ticket purchase for Diamond and Platinum Medallion members, 72 hours before departure for Gold Medallion, and 24 hours before departure for Silver Medallion. These must be selected manually by the passenger. Complimentary upgrades to C+ are available for on all Delta flights that have C+ seats open, regardless of distance.
While this is all specific to Delta (because that's the one I'm most familiar with,) American, United, and Alaska Airlines have similar systems for their elite members.