To hide in combat, you must have Cover from the creatures you are attempting to hide from and use an action to make a DC 10 Stealth check (if you have Full Cover, you succeed automatically). The first attack you make while hidden is made with advantage, then you are no longer hidden. Most creatures will not prioritize hunting for hidden heroes while other dangers remain.
Hiding
Core Rules v2 p. 8
Related Rules
3ConditionsReference / Indexes
CoverCombat / Positioning & Control
SkillsFundamentals / Stats, Skills & Checks