The applicable DOT regulation,
14 CFR 250, requires each airline to have an established procedure for determining how they will select the passenger(s) who will be involuntarily denied boarding (IDB) on an oversold flight. At the time, most airlines prioritized by passenger status in the frequent flyer program and fare paid over boarding time. The idea was that your best customers (frequent flyers and those who paid the highest fares) were given the benefit of boarding whenever they wanted without increasing their risk of being bumped.
Many airlines have since changed their priority procedures. Check your airline's website for how they prioritize IDBs. They tend to be similar, but not identical, from airline to airline.
It was four Republic crewmembers, two pilots and two flight attendants. They had been scheduled to deadhead on an earlier flight that was on a maintenance delay. The delay for that flight had reached the point that they were not going to get to Louisville in time to get the required rest before their scheduled flight in the next morning which would require delaying that flight for crew rest. Republic's crew schedulers moved the four crewmembers to Dao's flight after Dao's flight had started boarding in an attempt to still allow the flight the next morning to depart on time.
Normally, the gate agents have some warning on a oversold flight so they can get the volunteers early or, at least, prevent those who are in danger of being IDBd from boarding. In this case, the late change from the delayed flight to Dao's flight was a surprise to the agents working the flight who didn't learn of the four new positive space passengers until the flight was already boarded.
Two of the first changes that UAL made in response to this event was that positive space passengers can not be added to a sold-out flight within 60 minutes of departure (before boarding would have begun) and passengers who have boarded can no longer be involuntarily removed for an oversale. Airlines have also dramatically increased the amount of voucher credit they will issue to get passengers to voluntarily give up their seat. I've seen them as high as $5,000 myself and heard of offers approaching $10,000.