If you’re out of all enemies’ line of sight (or other senses that can pinpoint your location), and have something to hide under/behind, you can choose to hide by making a Stealth check.
Until you are discovered, or you stop hiding, that check’s total is contested by the Perception check of any creature that actively searches for signs of your presence. While hidden, you have Sneak Attack advantages over targets that can’t sense you. The Sneak Attack typically reveals your location.
If your actions give away your position, such as shouting, or walking into line of sight or hearing range, you reveal yourself and stop hiding.