Detect a Secret Door or Compartment
Senses. When you seek evidence of a hidden or secret door, portal, or compartment, you usually make a Wisdom (Perception) check against the specified DC. (82) See examples.
Moving at a fast pace can give you disadvantage.
Proficiency with certain tools sometimes helps.
Logic. Sometimes senses are not enough. You need to make an Intelligence (Investigation) check instead of, or in addition to, a Perception check. (81) See examples.
Lore. A lore-based Intelligence check might help in certain situations. (81) See examples. House Rule: You can attempt an Intelligence (Arcana) check to detect a door that is magically hidden. (195)
Using magic. Use spells or magic items to discover hidden things.
Passive perception. Even when not actively searching, you might detect a hidden door, etc., in passing. See examples.