Make the players care
The depth of lore and details of the world are (for some people) what makes the world engaging. As worldbuilding DMs we love to craft extravagant histories and complex lore to fill our world. This is all a waste of time if we fail to get our players to buy in to our world. We need them to care about the history and its people or the lore won't matter too them.
There are many ways to do this and they will vary between systems and DMs, I don't pretend to be an expert in all of them but this is some of the ones I have used successfully in my own campaigns.
Collaborative Worldbuilding
Including your players in the process of worldbuilding is the fastest way to get them to learn the lore, they helped write it. This method has the added benefit of reducing the workload on the DM.
In my campaign I do this by allowing my players to create their own home towns, complete with culture, history and NPCs. I ask them for at least half a page of writing and then ask additional questions to help fill out the town. I then place these towns on my world map and allow them to dictate the surrounding regions; small rural towns necessitate a wilderness region, large capital cities become major trade locations.
I also allow them to influence how their chosen race is seen in the world. For instance I had a dwarf players who came up with how the dwarf society was structured and how they interacted with the other races. I adapted this slightly to fit into the campaign and that player was instantly an expert on her own race.
Knowledge skills and lore checks
Once my players have established their backgrounds and home cultures I use them to assess what parts of the worlds lore they would be aware of. When parts of the lore become relevant I prompt the appropriate player to make a knowledge of the relevant type. I don't use a fixed DC for this but instead the higher they roll the more information I give them.
I always make reference to where the character learned the information, the wizard learned in in his years of detailed study, the bard in the folksongs they sang as a child, the street urchin overheard it in the alleyways they grew up and in and the noble learned it from an old wise uncle. Whatever the source I make it relevant to the characters backstory. This helps to make the players feel their backstories are actually important meaningful choices and that will affect the information available to them in the game.
It is important to share these rolls around and not just give them to the players with high intelligence. Sometimes the half-orc with a 6 in intelligence will know more than the wizard simply by having lived through it.
Lore Handouts and Session 0
At the start of campaigns it is important to prepare your players on the world they are entering. I will often give a detail exposition of the world during session 0, this helps in getting characters that fit the theme better. Sometimes players will express an idea during this session that you can incorporate into the campaign.
You can boost this by sending out world primer handouts ahead of time to prospective players and only bring in those that are interested in the world. By canvasing more people and only bringing in the players interested in this campaign specifically you have already avoided a lot of issues with player buy in down the line.
Session Recaps
Between each session of my campaigns I write up a short exert of between 50 and 500 words. Sometimes this will be humorous retellings of the best moments of the last session, sometimes I use it to express things from the bad guys or another NPC's point of view, adding extra dimensions to these characters. Whenever I can though, I use this to inject additional lore into my campaigns. I lay hints and clues about grander scheme of things, linking the dots the players missed.
At the start of the next session I read this aloud to my players. This ensures they have at least heard it once and helps to set the scene and mood at the start of the night.
Show the history
When traversing the tunnels below an old city the players find writing in a form they don't understand, though the symbols seem very similar they are more archaic in form. When traveling across the desert the find the ruins of a city long past, the same runes mark the stonework here.
If your lore contains a precursor civilization show it in the world they travel through. There will always be artifacts and architecture left behind. New cities are built atop the old, but there are secrets to discover below for the brave souls willing to find them.
My current campaign features a dominant and tyrannical dwarven empire that was overthrown hundreds of years earlier. The history of distrust however is still evident throughout the world. Dwarfs are hated throughout large parts of the world and I ensure my players feel this (I cleared it with only dwarf player ahead of time). Though the empire itself it gone evidence of dwarven architecture and influence can be found in all corners of the world. This has worked so well to get my playing interested that our next campaign will be set 100 years before the fall of the empire.
NPC Storytime
Sometimes there is a particular piece of lore that is relevant but none of the players would have reason to know it. In these situations I introduce an NPC to educate the players. After earning the players trust the character says something like "Do you know the story of....?" this has always been enough of a hook for my players, provided you keep the story short and interesting.
Other times the law can play out through the character arc of an NPC. I have a religious order that cuts of hands of those they expel. I introduced the law though one of the victims, the players helped him get vengeance and learned of a powerful order in the process. Win-win.
Conclusion
The lore of the world should inform and drive the story, a story that is being played out by the players. So you need them to want to play out the lore of the world. Connect the lore directly to the players backstories, make it personal and useful and they will seek more. Lace hints of the past throughout the present, make them obvious and your players will take note. Use NPCs to fill the gaps and answer the players questions.
If done properly by the end of the campaign your players will know your world almost as well as you do. And by making them care about the world, that world ending epic level threat at the end of your campaign means so much more.