When making a ranged attack against a target engaged in melee combat, the attacker must always subtract dice for the other combatants. The amounts don't change: -2 for every character in melee, and -4 for every character in a grapple with the target. Normally, the attacker errs on the side of caution. If their attack misses, no one takes damage.
What if the attacker doesn't care? In this case, the GM sets aside the subtracted dice, noting which dice are for which character. After the attack is resolved (regardless of success), the GM rolls each set of dice and assigns any successes as damage to the relevant character. This damage is of the same type as the attacker's weapon, though the dice do not benefit from any special mechanics (like 9-again, rote, etc.).
Burst attacks do not benefit from this rule: attackers cannot pick and choose who gets hit by a chaotic spray of bullets.