A select few features occur, not when an attack roll is made, but instead when an attack is made.
Three examples are the Protection Fighting Style, the Vengeance Paladin’s Soul of Vengeance feature, and the Arrow-Catching Shield magic item. These states (emphasis mine):
When a creature you can see attacks a target other than you that is within 5 feet of you, you can use your reaction to impose disadvantage on the attack roll. […]
[…] In addition, whenever an attacker makes a ranged attack against a target within 5 feet of you, you can use your reaction to become the target of the attack instead. […]
[…] When a creature under the effect of your Vow of Enmity makes an attack, you can use your reaction to make a melee weapon attack against that creature if it is within range. […]
Notably, there are numerous other features that occur when somebody is targeted by an attack, or when somebody makes an attack roll, or when somebody is actually hit with an attack, but none of the features above specify any of those scenarios. Examples of features that do specify are the Mastermind Rogue’s Misdirection feature, the Lore Bard’s Cutting Words feature, and the Monk’s Deflect Missiles feature:
[…] When you are targeted by an attack […]
[…] When a creature that you can see within 60 feet of you makes an attack roll […]
[…] when you are hit by a ranged weapon attack. […]
As such, I’m unsure when the Protection Fighting Style, Soul of Vengeance, and Arrow-Catching Shield actually takes place. Are they before the target is determined? Before the attack roll is made? After the attack roll but before knowing if it hits or misses? After knowing if it hits or misses? After the damage is applied? Does it vary with each feature? Is it some other answer entirely?