The tendency to recall information better if one is in the same pharmacological or psychological state as when the information was encoded is known as: State-dependent memory effect
Our memories are interconnected with another. So, if we're exposed to a similar environment when an information was encoded, it will trigger the correlation inside our memory which could make that memory appear to the surface