to hide something away: to put a person or thing out of sight, whether to keep it safe, to keep it secret, or to lie in wait unseen.
The one idea running through this word is putting something out of sight. What changes from place to place is the reason for hiding it. Sometimes you hide a person to protect them, the way Moses' mother hid her baby. Sometimes you hide yourself to spring on someone, the way robbers crouch out of view along a road. And very often you tuck something valuable away for safekeeping, the way you would store treasure, which is why translators frequently render it "treasure up" or "lay up."
That last shade is the one the poets and wisdom writers love most. To hide a teaching in your heart is not to bury it but to keep it close and safe, ready when you need it. The same picture works for good and for ill: God is said to keep goodness stored up for those who trust him, and to keep trouble in reserve for the guilty. In each case something is deliberately set aside, kept back from plain view, held for later.
So the senses below are not separate words but one action seen from different angles: what is hidden, and why. A thing hidden for safety, a person hidden from danger, an ambush hidden from its victim, and a treasure hidden away for the future are all the same basic act of tucking something out of sight.