The reason why historians remember all the history books they read is because they use the information. History books--academic history books--are not experiences, they're TOOLS. When I get an academic book, I read it to figure out how I can use it--and then I remember it when I do use it (either in a lecture, a citation, or some background knowledge for a project.)
A few of my colleagues have amazing memories. But for the rest of it, we remember it for the same reason why musician remembers their famous songs: because they have to play them every day.
This is a good question. In my (admittedly limited) experience in extensive research, I have found that since you are becoming an expert in a very niche field when you conduct research, you are reading a lot of the same stuff. When you have read or skimmed through one book on a topic, particular names and concepts show up again when you have gone onto the next book or article, so this reinforces their existence and importance in your mind. There will be a lot of recurring themes and names, seeing them time and again makes you recognize their importance.
Furthermore, I'd like to be fair and say that I forget a LOT of things that I read or listen to regarding history. The most effective method is simply writing things down. When I write things down once, I find the likelihood of me remembering it is doubled if not tripled, and I know I can always go back.
I think a lot of the memorization really comes from the moment when a historian decides to dig into their topic and focus solely on that, that he or she begins to have a serious command of the subject off the top of their head. I'm not sure there's a secret besides reading a lot, and taking notes where you find it important to do so.
I tend to have a really good memory of things I have read. Many times when I answer questions here or on AskAnthropology I just do most of it from memory and then use books for very specific quotes and things like that. The thing is that, when you read an academic work you should be trying to find the main idea of what you are reading. This usually isn’t hard to memorize. At a certain point you just memorize the main points of a book or paper without really trying to. For more specific things, that is harder to do.
If I really am putting a lot of effort into documenting my reading of something, what I will do is take notes while I read. Usually academic books and papers are broken up into convenient sections for you, so it’s easy to structure your notes around those sections. I take extensive notes. You should do this by hand too. Writing these things down by hand helps immensely with memorization.
The other thing is, if you have an opportunity to talk about what you study, you should. That also commits things to memory. Talking with friends, colleagues, teachers, etc about what you learn or study helps memorization since you are actively thinking about the topic all the time. So does answering questions here. Certain topics I have memorized extremely well from answering people’s questions about them on Reddit.
Aside from the things others have said — you know what you use regularly — I would just add that the key thing about historical information is it is not about remembering isolated facts, but about information that is weaved together through narratives. So it's not like I'm trying to remember one random piece of information (say, a date), it's that I'm telling stories in which one event (or person, or whatever) is connected to other events.
Do I remember every little detail or date? Of course not — I look them up, and even the ones I think I remember, I double-check. It's easy to get a single date wrong (and embarrassing!), so you check. That's fine. The bigger narrative is what matters, and will guide you as to what little isolated details you might need to look up.
When you first start with history, everything feels isolated and arbitrary — dates, names, battles, countries, treaties, whatever. It's very hard to "start up" your brain in this mode of thinking. But as you continue doing it over the years, you read more and more about specific things you're interested in, you start seeing how the stories connect together, and those networks you're setting up in your brain start to get better reinforced. This makes it much easier to add new information as time goes on, because you're not creating a new memory pathway for it from scratch, but appending it to an existing one.
When you write about something, or especially if you teach about it, you reinforce those pathways as well. So anything I have taught multiple times, I tend to know by heart. Not because of any magical tricks, but because — as we know from neuroscience — every time you add a new way of accessing or using memory information, you make those mental connections stronger. Teaching, for whatever reason, is in my experience the ultimate memory device, even more than writing. There's something about having to re-synthesize the information verbally, in a (perhaps vain) attempt to get other people to learn or care about it, that makes the brain think, "oh, this memory is important, let's really hold it down."
I say this as someone who doesn't have a particularly great memory, especially for numbers (I have some kind of difficulty with holding them in my head that appears far worse than most people; I can barely remember a new address for more than 10 seconds without writing it down). But I know what I have reinforced again and again, either through writing, teaching, what have you. And even then, I sometimes go back and re-check things! There's no shame in that. We're not computers, thank goodness, yet we live in an age where double-checking a simple fact can usually be done in seconds.
I have a pretty good memory, and there's a lot of what I know that is definitely in my head, but to me, one of the biggest things I've learned since going to grad school for history is that it's not about knowing everything, it's about knowing where to look to find it. I now have an expansive context so that if I want to know the date that something happened, or what the predominant opinion on an issue is, I know what database to look it up in, which scholars to rely on, and what additional information is relevant.
I find creating a mesh of knowledge is important, as in you study a bit here and a bit there and the interconnections help to build a whole image in your mind. That combined with being really interested in the material makes it easy to remember.
Not sure if this will get removed or not, there's no proper citations or anything but OP you should check out /r/mnemonics. It's well suited for historical data. Here's a thread where I explain how I memorized King Henry VIII's wives: https://www.reddit.com/r/Mnemonics/comments/adwe4c/how_do_you_go_from_being_able_to_memorize_20/
I used the same system to memorize all the kings of England, people who are really good at it can memorize an absolutely staggering amount of information. I'm talking like tens of thousands of digits of pi, shit like that.