Why is it that when you’re trying to remember something, it sometimes pops into your head when you stop trying to remember it?
Ideas and latent thoughts reveal themselves when the brain is using the Default Mode Network (DMN). This condition is characterized by brain activity in the alpha wave range. It is not clear whether solutions and memory reveals happen directly in the DMN or whether the DMN is used simply as a path for transmission to consciousness.
You can read a good bit about the DMN in The Cambridge Handbook of the Neuroscience of Creativity (2018) Rex E. Jung (Editor), Oshin Vartanian (Editor). This is a long book that explores many aspects of creativity, including DMN associations.