Practice practice practice.
To add to that, if you learn their generic name, they sometimes have the same suffixes e.g. -pril for ACE inhibitors or -lol for beta-blockers.
To learn some of them, I read scenarios on here, looked at the patient's PMH, the drugs they took, thought about which one is associated with which condition, and also what I'd administer to treat their conidition e.g. if the patient is experiencing NV, I may consider administering promethazine. Learn their different names, dosage, the route & technique to administer them, their inidications, contraindications, and considerations/cautious use.