The whole rules passage is important to gain an understanding of what I believe the RAW intend. Points 4 and 5 in the notes below the rules quote are the key ones.
Player's Handbook p189
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.
Splitting it up into bullet points:
- 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.
Point 1: Whatever else, in the end the DM decides who might be surprised and has the rules below applied to them.
Point 2: If no one is stealthy everyone automatically notices that there is "a threat". No one is surprised, everyone gets to act on their first turn of combat. See Point 5 below for the required interpretation of "a threat".
Point 3: If at least one person tries to hide then everyone on the opposing side has to compare their passive Wis(Per) to the hide skill roll(s). It does not have to be everyone in a group trying to hide for this step to be important and necessary as surprise is not the only outcome of a successful hide roll. For instance it would determine who a rogue is successfully hidden from at the start of initiative, even if they see a fighter who is not hiding.
Point 4: Anyone who does not notice "a threat" is surprised. See Point 5 below for the required interpretation of "a threat".
Point 5: If you are surprised then you can't move or take an action in your first turn of combat. This means that "a threat" must mean any threat at all or the RAW are nonsense (which they aren't). If you see "a threat" of any kind you can and will react and do things, so "a threat" referred to in Points 2 and 4 must mean any threat at all. Therefore you are only surprised if you see nothing of the opposition, whatever that is (it could be a load of traps rather than people). But as noted in Point 3 just because you aren't surprised does not mean you have noticed every threat.
Point 6: Each member of a group can be independently surprised. Bummer.
The key thing here is that the term surprised used in the rules here is a "condition", not an adjective. A character has the surprised condition if Point 4 is the case, i.e. they have not noticed "a threat", any threat. If they have noticed "a threat", any threat, then they are not surprised. It does not matter how many threats there are, someone only needs to notice one not to have the surprised condition.
Used as an adjective, i.e. not RAW just a story description, they might be surprised by the rogue jumping out of the tree but that is not the surprised condition unless Point 4 is the case.
In addition to the above there is a phrase used in the rules "If you’re surprised, you can’t move or take an action on your first turn of the combat". The key bit is "your first turn of the combat" meaning that it is possible for someone to be surprised even after the fight, or whatever, has started. They would somehow need to be unaware of any threat for some reason. Perhaps an illusion, deafness and blindness, reappearing from a benignly cast "disappearing" spell? I've not tried to create exact examples of this (anyone?). I can see possibilities around teleportation too...