As usual CR hit on a point I was going to make.
As a DM, I typically expect the players to win every combat encounter, and to "win" the adventure. Not because I "let" them. But because that's the default assumption. Players do stuff or try new tactics, until they are successful.
The encounters are usually scaled to the party level, which means, on some level, the party is expected to win. There's always variance in what it takes to win, and the party's status after winning.
In the same vein, if you run a murder mystery plot, there is an expected path. PCs get involved with murder investigation. PCs follow clues. PCs confront murderer. There's a whole bunch of variance that can happen in there AND follow that chain of events. There's also the possibility of NOT making it to the end confrontation. But generally, you start with a basic path, and ad-lib the changes as you go.
Why? Because it is easier to plan on a basic obvious path than to plan on all possible paths and outcomes. Plus, since no plan survives contact with the enemy, you'd be wasting your time over-planning elements that won't be used.
The elements you use to write your murder adventure will include clues, NPCs, a villain, and some locations. As the PCs wander around your "plot", you'll have to shift these elements to keep up with the party's choices, to give them an outcome, as befits their choices.
This is no different than on the DM's turn during combat, he looks at how many orcs he has left, where they are in relation to the party, and gives them actions to continue the combat to an outcome that befits the party's choices.
Basically, just because I wrote an ambush encounter with 5 orcs that I expected the party to deal with and continue on their quest, doesn't mean the most obvious outcome will happen. I use the bits I have to make each round make sense relative to what has occurred. That may even mean having to orcs capture rather than kill the party because I was on the cusp of a TPK in what should have been an easy encounter, due to good rolls on my part, and bad rolls for the players.
Likewise, in my murder mystery, I use all the elements I wrote up to keep the investigation the PCs are actively pursuing in motion. That means moving things along with some new events if the game gets bogged down due to confusion. it may mean shifting things entirely if the PCs go down a new direction. Since you can't have a murder mystery without a killer and some clues, you've got to have a plan of how the basic path works out.
This in turn does not make it a railroad. It is simply running the game. Which since the dawn of RPG time, has been what GMs are expected to do. And since a number of us are able to run a game using these methods, without making it a railroad, and making it a challenge and not a "freebie feel-good" ride, all these arguments about railroading are...off track.