the answer to this question is object permanence
object permanence refers to the understanding that an object will still remain in a place even though we stop observing it directly.
This psychological phenomenon is the one that make children think their parents is disappearing when they're playing peek-a-boo.