Best to go back to the source on this; italics are my emphasis.
Stealth. Make a Dexterity (Stealth) check when you
attempt to conceal yourself from enemies, slink past
guards, slip away without being noticed, or sneak up on
someone without being seen or heard.
When you try to hide, make a Dexterity (Stealth) check. Until
you are discovered or you stop hiding, that check’s total is
contested by the Wisdom (Perception) check of any creature
that actively searches for signs of your presence.
You can’t hide from a creature that can see you, and if you
make noise (such as shouting a warning or knocking over a
vase), you give away your position. An invisible creature can’t
be seen, so it can always try to hide. Signs of its passage
might still be noticed, however, and it still has to stay quiet.
In combat, most creatures stay alert for signs of danger
all around, so if you come out of hiding and approach
a creature, it usually sees you. However, under certain
circumstances, the Dungeon Master might allow you to stay
hidden as you approach a creature that is distracted, allowing
you to gain advantage on an attack before you are seen.
Passive Perception. When you hide, there’s a chance
someone will notice you even if they aren't searching. To
determine whether such a creature notices you, the DM
compares your Dexterity (Stealth) check with that creature’s
passive Wisdom (Perception) score, which equals 10 + the
creature’s Wisdom modifier, as well as any other bonuses
or penalties. If the creature has advantage, add 5. For
disadvantage, subtract 5.
For example, if a 1st-level character (with a proficiency
bonus of +2) has a Wisdom of 15 (a +2 modifier) and
proficiency in Perception, he or she has a passive Wisdom
(Perception) of 14.
What Can You See? One of the main factors in determining
whether you can find a hidden creature or object is how well
you can see in an area, which might be lightly or heavily
obscured, as explained in chapter 8.
The DM decides when circumstances are appropriate for hiding. Also, the question isn't whether a creature can see you when you are hiding. The question is whether it can see you clearly.
... You can try to hide when you are lightly obscured
from the creature from which you are hiding. ...
A given area might be lightly or heavily obscured. In
a lightly obscured area, such as dim light, patchy fog,
or moderate foliage, creatures have disadvantage on
Wisdom (Perception) checks that rely on sight.
A heavily obscured area—such as darkness, opaque
fog, or dense foliage—blocks vision entirely. A creature
in a heavily obscured area effectively suffers from the
blinded condition (see appendix A).
Note: Darkvision is dim light and results in a lightly obscured area. Torches, lanterns etc are bright light.
My takeaways from all of this:
- you can sneak up on someone without being seen or heard
- you are hidden until someone finds you or you stop hiding
- you can't hide from someone who can see you but you can hide from their friends who can't see you
- in combat "if you come out of hiding and approach ...". If you come out of hiding and stand still or move away, the creature would need to perceive you.
- The Skulker feat allows you to "try to hide" if you are lightly obscured. I have no other support than this but to me it implies:
- you can hide if you are heavily obscured (or are a lightfoot Halfling hiding behind a bigger creature).
- You can stay hidden if lightly obscured since this only says "try to hide"
- Being seen is not enough for you to stop being hidden - you must be seen clearly. Lighting, cover and camouflage would all influence this.
Hidden means "unseen and unheard" (p. 195) so it incorporates and is superior to being merely "unseen". If the circumstances are right it can be better than invisibility without needing the spell.
Consider a combat with darkvision only (everywhere is lightly obscured). If there are things to hide behind (pillars, tables, walls) then the rogue can move behind one, hide and move anywhere that is no closer to the enemy with a good chance (Wisdom (Perception) at disadvantage) that no one knows where he is. Anyone targeting has to guess his location and even if they do they attack with disadvantage. If you are clever, you can move where the enemy is likely to move past you (AoO) on their turn or have your big strong Barbarian/Fighter/Ranger/Cleric companion grapple someone and bring them to you.
A party is camped at night in a featureless plain (i.e. no cover at all) and are attacked by a group of goblins. Now, goblins have this:
Nimble Escape. The goblin can take the Disengage or Hide
action as a bonus action on each of its turns.
Assume that there is a campfire giving bright light for 15 feet and dim light for another 15 feet. Also assume 2 (of 4) PCs have darkvision.
At the start of the combat the goblins spread out around the camp and attempt to hide. They have time to get in position so lets give them advantage. As they approach they are "unseen and unheard" and have a Dexterity (Stealth) DC of [highest 1 of 2d20]+6.
A passive Wisdom (Perception) check is appropriate (with disadvantage) to see if the PC on watch hears or sees anything as they approach to just inside the ring of (dim) light. A non-proficient PC with average wisdom has a passive Wisdom (Perception) of 10, -5 for disadvantage means he is not going to hear anything, ever. A 1-4 level Cleric will have a passive Wisdom (Perception) of 15 or 16, by 8-12 level this rises to 19 to 20 and at 17-20 to 22 say; the goblins will creep up un this gal about 80%, 55% and 36% of the time respectively.
If they are undetected, they attack with surprise, each shoots an arrow (with advantage if within the bright light) steps out of the light and darkvision range (5 feet) and hides as a bonus action and uses the remainder of their movement (25 feet) to circle around in the dark.
Now the PCs are in a real bind - they have no targets (every goblin is in the dark) but the goblins can see them due to the fire. If they extinguish the fire the non-darkvision PCs are blind but the darvision PCs aren't much better off.
Every turn each goblin moves towards where the PCs last were, fires his bow (becoming unhidden) if he sees one, then moves out of darkvision range and hides again (without advantage). Now the PCs can move towards a given goblin, actively looking so we make active perception checks (with disadvantage for low light). What are the chances they find him? For Wisdom (Perception) modifiers of 0, +5 and +10 they are 12.7%, 30.9% and 55.5% respectively.
If they do find him, well the goblin was at least 65 feet away so without special abilities no one can close to melee this round; they can use a ranged weapon or spell or a saving throw type spell (normally overkill for 1 goblin but needs must).
If the goblin survives he can move, Dash (action) and Hide (bonus action) and start the cat and mouse game again. Meanwhile the other goblins are sniping all the while.
Be careful; this is a likely TPK for low to mid level PCs and even high level PCs will burn some serious resources.