The Skulker feat lets one do this:
- You can try to hide when you are lightly obscured from the creature from which you are hiding.
Mask of the Wild does this:
- You can attempt to hide even when you are only lightly obscured by foliage, heavy rain, falling snow, mist, and other natural phenomena.
Lightfoot Halflings can do this:
- You can attempt to hide even when you are obscured only by a creature that is at least one size larger than you.
AFAIK these are the only methods by which a PC can hide (or be hidden) when lightly obscured (barring DM ruling).
If you lose that obscurement, (the halfling wanders away from behind a M creature, the rain stops falling for a Wood Elf, or someone turns on the lights for a Skulker) you automatically cease being hidden (barring DM ruling).
Lacking those abilities (unless a DM rules otherwise) you need cover capable of concealing nearly all of you (or all of you), or heavy obscurement (such as thick fog, darkness or similar) in order to hide or remain hidden. Hiding behind a tree and peering through the leaves, or a sniper hiding on the roof of a building with a loaded crossbow, covering the street below are examples.
If the tree you are hiding behind is suddenly disintegrated leaving only a large pot plant, or the fog you are hiding in suddenly lifts leaving only light fog, you are automatically no longer hidden (unless the DM rules otherwise).
A creature without Skulker can
not move down a hallway under direct observation and remain hidden, any more than a creature with Skulker can move down a brightly lit hallway under direct observation and remain hidden.
Why we have to continue this back and forth, when the rules are clear is beyond me.