Spread your siege tanks out.
Clumping is, in essence, situational.
When Clumping is Bad
In most cases, it is not safe to clump your units together with each other or with your buildings. There are two main reasons for not clumping your units.
Splash attacks & AOE attacks damage more of your units at once if they are clumped.
Consider some examples:
- Nuke: If everything is clumped up, you just lost everything.
- Mutalisk: A large clump of units is subject to the bounce attack, resulting in more damage per attack to your units.
- Banelings: A baneling that explodes into a group of units damages more of them.
- Blinding Cloud
Addressing your specific example:
If I group my siege tanks together they cover less area and once melee units get to them they all become helpless together; but on the other hand if I spread them around they're easier to surround and their friendly fire is really devestating.
You have two outcomes:
- Clumped together: You do no damage to enemy units. Your units die, the opposing army incurs minimal loss.
- Spread out: You do damage to both enemy and friendly units. Your units die, but the opposing army is smaller after the skirmish.
In the end, you're better off with the second outcome.
Enemy units have a higher effective DPS against your units if they are clumped because they spend more time attacking and less time walking between units.
Without going into a numbers game, this should still intuitively make sense. If you have three siege tanks all lined up together and they get rushed by zerglings, they can essentially turn and attack the next take as each one dies. If you are spread out along a ridge, the zerglings have to rub between the tanks. That results in less time where you are attacked and more time where the opponent is attacked.
When Clumping is Good
Clumping should be treated as the exception, not the rule. At the moment, I can think of one instance where clumping would be an advantage, and it doesn't actually apply in the case of siege tanks:
If you find yourself in a situation where your ranged army is going up against a pure melee army with no splash or AoE attacks, clumping can work to your advantage.
- Units in the core of the clump are safe from attack.
- All of your units can still attack the opponents melee units (provided they have no minimum range) even though the melee units will not all have access to the clump.
Since siege tanks have a minimum range, the benefit to clumping is essentially nullified. I describe why above when addressing the specific example given in the original question.