Mathematically, a ship should be able to fire more shots if each of the cannons fire at their fastest speed, instead of waiting for everyone to be ready, but it seems that a broadside is sometimes more preferable during the age of sail, despite sacrificing the efficiency. Why is it the case? And is there any guideline on when this is preferable? (e.g. when firing from long distance, short distance, against smaller ship?)
Using Aubrey/Maturin, beefed up with "Naval life in the time of Aubrey and Maturin" type texts:
- Shock and Awe. Few men died in most naval battles in the age of sail. Morale failure was a key structure in battle. Broadsides significantly reduced the numbers of boarders in a single wave. Three fast broadsides and board was an ideal to secure a prize by intimidating the opposing crew out of combat. Most boarding combats ended by flight below decks by the losing crew. This was a sign of surrender and an end to combat.
- Aimed fire. Naval broadsides were more capable of achieving specific aims, such as dismasting, sail damage, or hull damage. This is due to roll, pitch, limited windows of opportunity.
- Simultaneous damage. Wooden ships tended to resist damage fairly well. A second ball exploiting damage created by the first would be greatly advantageous.
- Avoiding hull damage. Rippling broadsides guaranteed the stress factors that hulls would take. Fire at will could involve multiple bordering cannons firing simultaneously based on a gun captain's judgement.
However, broadsides weren't always optimal:
- Chasers were regularly fired at will, this is because "the chase" involved attempts to damage specific components, where the advantage of component damage coming sooner would be immeasurable. Chasers were also usually fired in small groups, so the advantages of massed fire weren't present.
- Pitched close battle. In these circumstances broadsides broke down anyway, when ships of the line were engaged closely toppled guns, fire, deaths, chaos, blood and muck any semblance of order in fire broke down.
- Aimed individual fire for purpose. If a particular gun layer was perceived to be effective, at longer ranges, then a ship with the weather gauge and speed could attempt to selectively disable a potential prize. For instance, it might fire at the masts, attempting to dismast or partially dismast an adversary, such that they would be forced to surrender as the aggressor could then rake their length with fire.
"Guns firing on their own" may be a better tactic, particularly at the beginning of the battle, when what matters is the total rate of fire.
Broadsides are better when the order of the day is for concentrated fire. That usually happens later in the battle, when the idea is to do something decisive, or achieve "critical mass."
A broadside is better when the broadside is enough to sink the key enemy ship. In this case, you want to get off your broadside before he gets off his. First one to put out concentrated fire wins.
As pointed out in other answers, a broadside works best (to get the enemy to lower their heads and fire), when preparing to board an enemy ship. Also, the shock of concentrated (broadside) fire has a greater impact on enemy morale, even if "guns firing on their on their own" objectively does more damage.