Alright, I know there's already like a billion other posts like this, but I just wanna get out my theory of what happened when and why and how, mostly cause writing it down will help me to figure it out for myself, and partly cause i think other people might find it interesting.
Golden Freddy and Springtrap were the original mascots of Fredbear's Family Diner, where the first murder took place. The first child was murdered outside of the diner, as shown in the Take Cake to the Children game, and the Marionette transferred their soul into the Golden Freddy suit.
Years later, Fredbear's sells out and becomes Fazbear Entertainment, and the first Freddy Fazbear's, the one mentioned by the Phone Guy in FNAF 2, is opened. Though the Phone Guy ominously mentions that this location was "left to rot," nothing too horrible actually happens here. It's just a gross restaurant with creepy animatronics.
The rest of the murders take place during the events of FNAF 2. The Purple Guy who murdered the first child outside the diner came to Freddy Fazbear's looking for legitimate work. He took the night guard job, but was haunted by the Golden Freddy suit and the Marionette, who recognized him as a killer. After his first week, he complained about the conditions and was switched to the day shift. During the course of the week he murders four more children, using the Springtrap suit to lure them into the saferoom, as the Phone Guy alludes to, and is found out and fired. The company doesn't go to the police because they're afraid of the bad press, so they try to sweep the events under the rug. The children's souls inhabit the animatronics, though, and their bodies are hidden in the suits, so soon the restuarant is closed due to health and safety concerns, and the murders are exposed. A suspect is arrested, but he's not the actual killer - the purple guy is long gone by now.
Years pass and a new restuarant opens - the one featured in the original game. The animatronics are refurbished and functional, but the children's souls still inhabit them. They're scared and confused, and the programming of the animatronics is becoming mixed with their conciousness. They know they were killed by a guard, so they feel the need to seek you, the player, out. They also know that it is against the rules at Freddy Fazbear's for an endoskeleton to be out of its costume, so they feel compelled to stuff the player into a suit when they find him, whether they truly believe the player is their killer or not.
During this time, the Purple Guy returns, and hides out in the saferoom mentioned by the Phone Guy in FNAF 3. At some point, the animatronics catch on to his presence, and try to get to him to finally enact their revenge. They can't enter the saferoom, though, because of their programming - the Purple Guy takes advantage of this and attacks the animatronics when they turn their backs, before returning to the saferoom, as shown in the minigames between the nights in FNAF 3. This releases their souls from the suits, and allows them to confront him directly - in the final minigame, the five children's souls confront the Purple Guy, four of them barring the door while one chases him around the room. He tries to hide in the old Springtrap suit, and the mechanism holding down the endoskeleton fails and crushes him. The saferooms are then boarded up, presumably to cover up the events and hide the Springtrap suit as well as the Purple Guy's body. After several years, the building is torn down and the Springtrap suit is found and sold to the Fazbear Frights exhibit.
In the Good Ending of FNAF 3, the animatronics are shown to be at rest, the children's souls having moved on after getting their revenge on the Purple Guy. This may not be the true ending, however, as the phantoms still haunt the Fazbear Frights attraction, seemingly having followed the Purple Guy's soul in order to torment him. They jumpscare the player not to hurt them, but to scare them away, so they'll leave and not be hurt by the Purple Guy. The spirits themselves are not malevolent, but because of their programming, they're compelled to kill the player. Once they are released from the suits and free to roam as disembodied spirits, they no longer feel the compulsion to stuff the player into a suit.
Alright, I know that wasn't very eloquent, but I hope it makes at least some sense and was interesting to read. Anyone have any thoughts, anything to add, anything I am just completely missing?