Read passages from some codices (bonsu points for Imperial Armour from FW, Siege of Vraks, War on Baal is the shit), preferably 3rd, 4th ed, browse through shitload of stellar, old art, read some more additional, minor, materials on the internet (bonus points if you find old liber Chaotica, Xenology, Inquisition handbook, Uplifting Primer books). So like get a grisp about how stuff in general is, and then learn more about factions that particulary interest you, but not too much.
Now , make up headcannon for the rest, avoid new trash lore, and memes, and arguing with autists over the internet.
Here you are, best, most fun method .
You really should understand:
40k lore, All those Black Library books, new " le plot progressive" books and stuff is fucking trash. Sincerely. Books are 95% of times YA tier crap.
Read real fucking books, you zoomer.
And learning about 40k lore in such detail is autistic as fuck.
So, just learn the ropes and let your imagination go wild.