Based on my experience at not particularly busy Class D and C airports, it is first come, first served with some caveats.
All of the airliners and most of the jets have an IFR flight plan that has a specific time that they have to be off. If they are flying into a busy airport they may also be subject to an EDCT that further restricts when they can take off. The tower will manage traffic so that they can take off in their allotted time frame. In my experience, that mostly means that they will extend the downwind of planes in the pattern to get the big guys off on time. They will also keep you in the runup area a bit longer so that the big guys can take off on time.
I fly out of mostly smaller airports and what is much more common is for the tower to manage the traffic pattern so that airliners and jets can land straight-in or with minimal delay.
The rules might be different at places like Vero Beach where there is a lot of flight training.
To get a feel for how it works at a busy airport, search YouTube for "Kennedy Steve". There are lots of recordings of him moving planes around on the ground at JFK.