This applies in general but I think it's especially true against buildings since they don't attack back.
Make sure every unit is able to attack something. This usually means moving closer than max distance so the units in the back aren't fumbling around trying to get into range. (In army vs army, you'll want to do this if your army is bigger, but not if your army is smaller)
Against buildings that don't attack back especially, you'll want to split up your army to help with making sure every unit gets to attack something.
Doing the Stutter Step
also help to keep moving towards other buildings as you attack. Stutter Step is where you either Move->Stop(to shoot)->Move->Stop
or Move->AttackMove->Mode->AttackMove
.
Normally this is used to kite units with shorter range, but it's equally effective to spend less time not attacking. The key is that the attack cool-down is ticking whether you're moving or standing still, so in the time between shots you should be moving closer to other buildings. With enough practice you can move and attack while getting the exact same damage output as if you were standing still.
All of these technique though are different ways (that can be used in combination) to minimize the amount of time spent not attacking, which is the ultimate goal.