It’s a question my kids ask me a lot.
How do you still remember geometry, algebra, and trigonometry? How do you still remember the Latin you learned in 1992, or 150 digits of pi, or how to perform stoichiometry, and so forth.
The answer is simple: I deeply cared about learning all of those things. Regardless of the eventual “use” for them, I cared about knowing them. I was raised and taught to lean into my curiosity, and lean into it I did.
(There is an argument to be made that I might have been more discriminating about what I chose to be curious about, building deeper knowledge in fewer areas; that just because a school says “learn this” shouldn’t mean I unquestioningly should want to.)
We all have no trouble remembering the things we’re deeply curious about. You have things you learned long ago that stay with you, just because you cared about knowing them.
If you want your students to learn and remember the things you’re teaching, step one is to convince them to care about knowing them. They won’t all do that unquestioningly.