Here are two different d6 rolls that happen in AD&D:
*The roll to open a stuck dungeon door.
*The roll to determine whether or not a person (or party) is surprised.
The first roll is made
when a player declares that their character is trying to force open a stuck door. At that point, in the fiction, the PC is standing at the door, about to try and force it open. We can imagine
the roll of the d6 correlating to
the character's attempt to shove or shoulder the door. As the dice comes to rest and we can read the result, so we know what happened in the fiction: either the door yielded to the shove/shoulder, or it did not.
The second roll is made
when the GM determines that an encounter has occurred. (And has not decided that the PCs cannot be surprised.) The time of making the roll
at the table correlates to that event at the table. But it does not correlate to anything in particular happening in the fiction
at that moment. In particular, suppose it turns out that the PCs are surprised. The reason
why they are surprised - eg they're looking the wrong way, or are distracted by sorting through their gear, or relieving themselves (Gygax identifies this as a possible cause of surprise in his DMG) - has already come about, in the fiction, at the time the die is rolled.
<snip>
The traditional reaction roll (found in various versions of classic D&D, in Classic Traveller, and maybe other RPGs as well) is, in these respects, the same as the surprise roll.
The 2014 5e D&D rules for surprise are no different, as best I can tell.
From DnD Beyond,
Surprise
A band of adventurers sneaks up on a bandit camp, springing from the trees to attack them. A gelatinous cube glides down a dungeon passage, unnoticed by the adventurers until the cube engulfs one of them. In these situations, one side of the battle gains surprise over the other.
The DM determines who might be surprised. If neither side tries to be stealthy, they automatically notice each other. Otherwise, the DM compares the Dexterity (Stealth) checks of anyone hiding with the passive Wisdom (Perception) score of each creature on the opposing side. Any character or monster that doesn't notice a threat is surprised at the start of the encounter.
If you're surprised, you can't move or take an action on your first turn of the combat, and you can't take a reaction until that turn ends. A member of a group can be surprised even if the other members aren't.
Why do the adventurers fail to notice the gelatinous cube? At the table, *because their passive WIS (Perception) score tells us so. And then, if we like, we have to make up some retroactive reason, about what the PCs were doing immediately before this moment, that explains why they didn't notice the cube.