Warning: Spoilers for Bleach: The Thousand-Year Blood War, episode 15Bleach: The Thousand-Year Blood War's Quincy takeover of the Soul Society was dramatic and sudden, but at first glance, it doesn't make a whole lot of sense. How were the Quincy already inside the Seireitei, and where had they been hiding that kept them out of sight for a thousand years? The anime has offered an explanation, but it's a bit complicated.
When the Quincy Wandenreich suddenly replaces the Seireitei, all the buildings are instantaneously changed, and the Soul Reapers immediately lose their home-field advantage. They say they were able to do this because rather than having to enter the Seireitei's (near) impenetrable barrier, they were inside the barrier all along, "hiding in the shadows." That turns out to have been an extremely literal answer, and it does explain why the Quincy were able to dissolve into the shadows after their first attack. What's less clear is how they managed to do this.
The Quincy Created A Pocket Dimension Inside the Seireitei
The first thing that must be understood is that Quincy are masters of manipulating reishi, or spirit particles, which make up everyone and everything in the Soul Society. The Quincy of a thousand years ago were able to find a way after their loss to use reishi to create a "shadow realm," one that's literally accessed from the shadows around the Seireitei. They were able to use their mastery of reishi to expand the space and survive there, and even built up a fairly large city, which is at least comparable in size to the Seireitei. By hiding here, the Quincy of the Wandenreich were able to avoid the fate that befell other Quincy in the world of the living.
Hiding in this pocket dimension off the Seireitei gave them two major advantages: one, that the Soul Reapers would never suspect them of being there, so they wouldn't look for it, and two, it provided the ideal place from which to strike when the time was right. While it's not stated outright, it's likely that the Seireitei didn't have its protective barriers a thousand years ago during the first conflict, especially since they hadn't even formed the 13 Court Guard Squads yet. That would make infiltrating the Soul Society trivial, as it apparently was for those ancient Quincy.
Since the Quincy city was in a separate dimension overlapping the Seireitei, the Quincy were able to absorb the spirit particles of the Seireitei and bring the dimensions into sync, essentially flip-flopping which location was "on top." It remains to be seen whether that can be flipped back, but hopefully the Soul Reapers will find a way to do so. The Quincy and their shadow realm may be one of Bleach: The Thousand-Year Blood War's most confusing scenes, but there is an explanation for it.