Guides and Practice. And it might sound funny but picking up relics does do a good job as well, or at least back in ARR. After you've ran 350 times coppermine HM you will remember every damn mechanic in that dungeon. People could actually wake you at night and ask you about the boss mechanics, and you could repeat them without even having to think about. Same for the old trials, how to skip and how to deal with mechanics that are not skip able etc. Do that with every ARR trial and dungeon, you'll have remembered it all.

This now works for the HW dungeons as well, clearly it's a bit different concept but again it's practice. SB for example how I started remembering the mechanics for trials, I queue'd for 2 hours straight only into the SB trials. Memorized and practiced the phases, the error's etc. Hell I even spend 4 hours a day for a whole week, in the last trial of the MSQ, not because I needed to clear it still, because I needed other people to screw up, so that when playing a healer, I could see what's going on, how to avoid these mechanics, how to shield/heal/protect players better, when to heal, when to dps etc.

Then went on to dungeons, I picked 2 dungeons out of the SB content, and ran that for hours again same thing here, remembering for myself mechanics but also getting a good insight of other player errors that might have been avoided by themselves, or prevented by me with having to plan out my healing etc a bit more. Then I level'd a tank and a dps, getting some insight of specific content on different jobs is a absolute eye opener and in my opinion important.

In all it's just practice, some learn faster then others, and then there are people like me that just try to perfect everything. It can be a nightmare in any instance, because over archiving is sometimes not a good thing either.