Of course, the short answer to how he got there is "Afton did it", according to World. He "put the pieces in place." But the details are still vague, especially considering World's peculiar relation to canon. How exactly did William do that? Where were the pieces previously?
The most immediate answer is just to dismiss the problem as unimportant. FNaF's story is vague, it leaves dark spots for the imagination to fill. We know where BV begins and ends, what exactly happens in the middle is just something the story doesn't explore. This is not without precedent: Take Cake to the Children uses a jumpscare to tell us that that kid ends up in the Puppet, but there was no attempt to justify how they could've gotten there. It wasn't something the story prioritized at the time.
However reasonable this argument might be, it is deeply unsatisfying. So, many explanations have been proposed.
Maybe his soul split across the bullies' masks, which the Puppet attaches to the children in Give Gifts Give Life?1 "The spirit follows the flesh, it would seem, and also the pain," says Afton in TFC... so perhaps a purely emotional connection will suffice? Maybe his attaching to the animatronics is a result of his literal emotional attachment to the characters, his "friends"? Or maybe Afton simply willed the pieces into place? (throw in some Zero Point Field babbling for flavor.) Maybe the MCI was itself an attempt to recreate BV's fears, a sort of summoning ritual to tie BV to the animatronics?
These explanations are all fairly handwavey. Several of them are moreso thematic descriptions than actual explanations. And even if they can more-or-less explain how the pieces were put in place, they generally fail to explain where the pieces were beforehand.2 It is this question which interests me most, now.
An Answer
To be honest, there's only one particuarly good explanation. The pieces went into the plushies.The novels focus on Charlie, the illusory recreation of Henry's daughter, brought to life by his unique spark. That unique spark is, as Baby explains in TFC, a piece of Henry's soul which he shed into the Ella doll, by crying into it. This piece is then used to animate the Charlie robots, by physically housing the doll inside their bodies. (The doll is moved between the different bots as Charlie "ages".) In the case of the youngest Charliebot, smaller Ella doll is stored within the larger Ella toy, to give it life. Does this scenario sound familiar?
(Similar, perhaps even stronger comparisons can be drawn with Jake from Fazbear Frights, which would really solidify this as a recurring pattern. I haven't read TRJ, and I know the status of this parallel is contentious, so I suppose I will leave it at that.)
FNaF4's Night 6 cutscene clearly uses BV's 5 plushies as a representation of the pieces, fading away one by one as they break off.3 This theory is just to suggest that the pieces-to-plushies connection is to be taken more literally. If we want BV's spirit to have a physical connection of some sort... well, those plushies are quite literally the only things we see with him as he dies.4 ShatterPlushVictim is forced onto us.
This opens the way toward a new explanation for the Fredbear plush, prior to Night 6. Long before the bite, the plush was already haunted by a piece of BV's soul, which he cried into it. This piece grows into BV's imaginary friend, similarly to Henry's shed piece growing into his... imaginary daughter. This feels to me more plausible than claims that the plush is purely imaginary, or that it's brought to life purely by emotion.
Defenses
Is ShatterPlushVictim unnecessary, or redundant? I don't think so. ShatterVictim's abstract handwaving is clearly the biggest thing keeping people from believing it (or even understanding it for that matter). The plushies would ground it with a straightforward physical connection. With the Take Cake child in FNaF2, even if the physical connection was unspecified, the Puppet could at least be presumed to exist at the time. In BV's case, you have a strange situation where his spirit has to just sort of vaguely linger for 2 years, before the MCI happens. The plushies would exist to fill that gap- a gap which, I argue, certainly benefits from being filled. I think it's plausible that Scott shared these feelings.Another potential problem is the presence of the Fredbear plush in SL. There is, of course, multiple methods for addressing this with varying degrees of silliness. Maybe BV's golden piece haunted Fredbear directly during the bite, skipping the plush step. Maybe the piece has already been fully extracted from the plush. Maybe it's just a different Fredbear plush. I'm not sure.
The final aspect I will address is the Puppet's role in ShatterVictim. Because there is good reason to think she has one, considering the HW2 mech, and considering that some representation of the Puppet is conveniently present for each instance of "the pieces" being depicted (besides Ennard, who has Elizabeth instead). But there's no Puppet plush. Rather, the thing representing the Puppet in the Night 6 cutscene is BV himself. So... was BV's body stuffed into the Security Puppet? Was this the true meaning of "alchemist's fantasy"?5 Well... No, I don't think so.
I will suggest that the Puppet having a piece is by no means set in stone. BV's design matching the Puppet's feels more like a MemoryVictim connection than a ShatterVictim connection... For example, BV, who looks like the Puppet, is the caretaker for his plushies, the Classics, in his checker-floored room, which represents Freddy's. This doesn't imply the Puppet has a piece per se, it's just more Dream Theory esque parallelism to show the effect of his lingering memories on the future. It's also arguably necessary for the Happiest Day parallel to work. The shadow Puppet beneath Mangle's Quest is really not as damning as some would suggest, unless you also think the shadows beneath BB's Air Adventure imply BV has pieces spread across Balloon Boy (and/or his variants) and a tree.
I think that's all I have to say for now. My ShatterPlushVictim credence is around 70% at the moment.