I still remember exactly where I was when I learned certain topics. When I first studied BFS and DFS, it was King's Day in the Netherlands and I had gone to the university library. The library was closed, so I had to roam on the streets and took breaks to read.
Another time, when I was learning about heaps, I was on a train, sunlight shining in through the window. Those little details stuck with me, and now I can't separate the concepts from the moments in which I learned them.
I've also noticed how much mood matters. When you're trying to learn something, it helps to be calm and not agitated, and to create an environment where distractions are blocked out.
Actually, blocking distractions is a whole topic of its own. That's for another time.