There is an old saying that "when the cat is away the mice will play." Effectively it means when an authority figure/predator isn't watching - or doing some other act that would force certain behaviors - that those normally affected will slack off. I find it a fitting line for RPGs as well. Normally when the PCs are around everything is going so fast and hectic that there is little time for NPCs to do anything but react. But what about when the PCs aren't around? What happens then?
A Breathing, Living World
The idea behind this is to make your world seem more alive. In the real world when you're not with someone they don't cease to exist, or - at least - when you next meet up with them they have done something to pass that time. The same should be true in your RPGs with the NPCs as well. At least, if you want them to seem like they're real people and that the world itself could be real. A lot of GMs do this reactively. As in, when the PCs bring an NPC up - or when an NPC is slated to come up - they'll decide then and there what to do. However, if you keep up with the NPCs as the game goes along things can flow a lot more naturally. How do you do it?
Spreadsheets and Flow Charts
The GM who runs the L5R game I am in does it this way. She has the NPCs down and works on flow charts for them. In effect, from what she has said, it works something like this.
Agasha Doja's Day: Wake Up -> If PC is Present/If no PC is Present -> Mid Day (Stimulus/Left to Own Devices) -> and So on
A lot of work, perhaps, but it keeps things going. Because of this, while the PCs focused on certain aspects of court, Doja had a whole winter court we weren't aware of. He played Go in the evenings with the lord of the castle, spent his nights with a variety of women (who knew he was that smooth? not us at the time) and even secured his own wedding to another woman of the court that had also, by and large, been mostly ignored.
Goals & Progress Between Sessions
Perhaps not quite as good as the above method, but much easier to manage. Give the NPCs goals. Any NPC with a name should get a goal (or goals.) At the end of each session, look over what happened and determine what the NPC did in that time to achieve their goals and how they did it. Keep a note of it, and keep it in comparison to the PCs. This way if the NPC comes up in the middle of a session you have most of the heavy lifting done already and just need to fill a smaller gap.
This method does have the small problem of needing retcons. Sometimes a detail of what the players did may slip your mind, and the NPC will have done something that could have impacted the PCs. Because of this you may end up in a situation where the PCs should have seen something they didn't, and that can cause confusion. The trick to avoiding this is good note taking, and doing the NPC movement as close to the session as possible. Also, don't be afraid to ask your players questions about what exactly they did while prepping for the next session.
While I don't recommend this, you can just wing it. I've done it myself and it has worked out. This requires a knowledge of who the NPC is and what they want, plus the ability to improv. In many ways it is the worst of both worlds as it takes work to know who the NPC is, and leaves you susceptible to things that counter what the players know directly. it also tends to give worse results because you are never as creative on the spot as you are with time to refine later on. Still, in a pinch, it can work. Just grab a goal the NPC had, and work them towards it. Maybe they became a better duelist, maybe their mother died, maybe they're looking for revenge against a thief who took a valuable heirloom. Either way, put something in their life and cook the details up fast.
The effect when you do this right can be subtle. Your players may not even notice it at first because they're caught up in their own worlds. As the world reacts to them, they'll get used to it and keep doing things. However, as they act they will often forget smaller things left behind. When that happens, bring up some of those things and have the PCs go back. When they see how much things changed without them, perhaps even for the better, that is when you'll get the reaction. Do it right and the world becomes even more real. Let them see that all actions have consequences, not just their own. It can be an amazing experience.
My homebrew 5e DM Screen
10 minutes ago