When printers have the same weight (as determined by the value for "Speed" within the Device configuration), load balancing is based on values that are updated for the print queues when the transaction is inserted into the database. The printer that is selected for the job will be the one that has the lowest "pages_since_startup" value (as a point of clarification, this is pages since the PServer service startup, not the printer's startup). If one printer goes offline for a while, thanks to an error or some other event that causes it to be unavailable for print, more jobs will be sent to that printer when it comes back online. The "pages_since_startup" values are cleared for all printers whenever the PServer service is restarted.
If the weights (speeds) are different, there's a proportional calculation instead. Also, if jobs are being held for reprint for a device, that can affect load balancing.
Unfortunately, no note is taken of whether one printer is idle and another printing. This would require either the use of SNMP (a TCP device management protocol) to determine the printers' current status, or the use of the print server's Print Spooler. SNMP, while reliable, carries some inherent security risks and is often disabled on the network, and the Windows Print Spooler is not always accurate in its report of device availability. Therefore, neither are suitable paths for device status retrieval.