If I use Hex (PHB, p. 251) on a target and then hit it with all three rays of Scorching Ray (PHB, p. 273), do I add the extra 1d6 necrotic damage to each ray that hits, or do I only add a single 1d6 to the total sum of all rays?
Yes, you'll deal an extra 1d6 with every ray that hits. Hex says that:
You deal an extra 1d6 necrotic damage to the target whenever you hit it with an attack.
And Scorching Ray says that you:
Make a ranged spell attack for each ray. On a hit, the target takes 2d6 fire damage.
Finally, to make it really clear that all 3 rays count as separate attacks, we have the following advice from the Player's Basic Rules:
If there’s ever any question whether something you’re doing counts as an attack, the rule is simple: if you’re making an attack roll, you’re making an attack.
So yes, each ray of Scorching Ray is an individual attack, and they will all trigger Hex separately if they hit the target.