This is not covered by the rules intentionally
Your question is very logical, and I guess it naturally comes from the following points:
- The game rules define the game world
- According to these rules, a creature can take the Hide action
- After taking the Hide action, a creature can be or not be hidden
But does the creature know the outcome of its Hide action? It is a missing piece in the rules, so you've asked about it. Plain and simple, right? Why can this cause any misunderstanding and arguing?
Well, that's because the premises up above are not correct (or they are table dependent, strictly speaking). They suit the 3.5e or Pathfinder quite well, and are definitely true for a computer game, but they work poorly in the 5e paradigm. The Fifth edition tries to simplify rules and in the same time it moves to the older (2e AD&D-ish) paradigm, where the narrative truth was put ahead. You can read more about this paradigm in the A Quick Primer for Old School Gaming essay by Matthew Finch.
The rules do not define the game world
In the world a breastplate protects you because it is hard and sturdy, and it covers your vital organs. We, the players, use this simplified one-number abstraction only when we resolve a so-called "attack roll", in order to do it more easily. That does not mean the breastplate have have its "AC 14" somewhere.
The rules are not like the laws of physics applying to the game world. The rules is a DM's tool, which they can use to figure out an outcome of a situation. For more information, read "The Role of the Dice" chapter in the DMG. My point is — all the things you can read in the Player's Handbook do not encompass the whole game world. So in the game world creatures can (and will) hide because that's how they live, not because there is "the Hide action" in the PHB.
PHB gives you basic roleplaying guidelines and basic game mechanics, so you know what to expect from the DM. But it does not tell you what a DM should do, nor it describes any actual "laws" of the world. Instead, the game world is supposed to be vast and living, and you explore it, working with your DM through a conversation. For More information read PHB page 6 "How to play" and DMG page 9 "A World of Your Own".
You don't "take the Hide action" in order to hide
Well, that's a tricky one, so let's talk more about D&D history a bit. There is a reason why skill checks were removed in 5th edition.
In previous edition, players are supposed to say "I use X skill" when they wanted to achieve some goal. So you declared the mechanics and get the effect. Now you describe what do your character do in the first place, and then the DM might (or might not) use any game mechanics in order to resolve the outcome.
So you don't hide because you've taken the Hide action. The flow was reversed — now you take the Hide action because you're hiding, and you're hiding because, as a player (or a DM), you are describing the respective character actions. Things are more strict in combat though, but in general, "rules as written" does not mean "the only right thing" anymore — DMs are supposed to stick to the narrative truth, going with what's best for their story, not just "following the rules as strict as possible". That's why the rules are intentionally silent on many corner cases now.
"Hide" action in the rules does not actually describe hiding
The Hide action is a part of the "actions in combat" chapter. That does not mean you can not hide out of the combat. That means these particular mechanics matter in combat because of the action economy, so the action economy is the thing the rules description says about:
- Hiding in combat should have benefits for attack in terms of mechanics; that's why you have Advantage
- Hiding in combat is powerful because of the positioning, so it spends resources (it takes an action, unless you have a feature that allows you to use a bonus action)
- Hiding in combat is also risky, so it's not automatic; that's why it requires us to roll dice
But these particular mechanics do not describe all the benefits from hiding. The rules intentionally do not say things like "enemy is (not) aware of you when you are hiding" because it's not a matter of mechanics now, it's a matter of the common sense, a current context and your narrative positioning (more on this later).
A creature is not either "hidden" or "not hidden"
"Hidden" is not a condition nor a boon a creature can have. Instead, "hidden" describes your narrative positioning. You can't be just "unseen and unheard", you are always unseen (or unheard) by somebody.
But your whole positioning means even more. Imagine you're a rogue searching through a manor, suddenly you hear a guard coming through the corridor. What do you do?
- You freeze, staying still, making no noise, waiting for the guard to leave
- You stand right behind the door, ready to stun an enemy with your sap
- That nearby chest is empty, you get into that chest and close it, leaving a small slit to peek out
All three situations can be modeled with the same "Hide action" so they are identically in terms of mechanics, but they differ drastically in terms of the narrative positioning. It's a thing in 5e now, a good DM should take it into the consideration.
If rule do not cover this, how to understand, what's going on
So what do you do? You use the common sense. In the real world, do you know if you're not longer hidden? When someone notice you, no "eye" icon appears in front of you, neither you hear an alarm sound. Instead, you can (or can not) figure it out by the behavior of the creature searching for you. The same approach can be used in the 5e game.