I can't seem to remember while i study and read topics

I failed an exam for computer architecture - computer science stuff iykyk. When i read the topics and try to remember them - i forget every detail about it. For example: I'm reading one topic which it can be 3 to 7 pages, I try to remember the details, then i move to the next topic and suddenly the previous tropic that i read about, I forgot everything.

This subject left me with sleepless nights because of projects, making all nighters and consume caffeine (coffee, coke, energy drink).

Please, tell me some tips to improve!

I would appreciate :)