This is only half the object, however - because it only describes the structure of the content being written. Once the structure is understood, it is absolutely necessary as a creator to play dumb - because the other half of writing a novel is to write it forward, from the point of view of a character who has absolutely no knowledge whatsoever about the book's structure.
Some authors can't quite do this - and so their mysteries tend to be filled with stock characters going through the motions, which can be acceptable to mystery enthusiasts but tends to make a rather dull, plodding case for other readers. This is why mysteries so often fell into the category of 'pulp fiction' - because while they weren't written very well, they yet appealed to a particular audience with a particular taste, who could be satisfied with the mystery structure alone.
Where it comes to role-playing, it has to be noted that the standard practice of writing a mystery is turned on its head. While in a novel, the writer and the character are the same person - so that the character can be pushed in the right direction to make sure the clues are discovered - in an RPG the DM and the character are NOT. The character is someone completely ignorant . . . and that pushes the DM to use a heavy hand, occasionally, when the players aren't: a) learning the right clues; or b) interpreting them very different than the way they are meant to be interpreted.
This latter reason is likely why your last attempt at a mystery campaign failed. Your players are not Hercule Poirot. They won't 'conveniently' understood the clue that has been carefully 'worked backwards' by the plottist - rather, they will overthink it, massively underrate it or overrate it, and in short order make a ghastly mess of the mystery they're supposed to solve.
At the beginning of my game this last Saturday, the players started by congratulating themselves. The very last action that had been taken in the previous session was the discovery of a secret door that revealed a nest of scrolls. As we began, then, the players were saying, "Isn't it great that we discovered a secret door the only time we actually looked for one?"
Now, normally, the players would just assume that I had invented the secret door the moment they sought one - but this was Ternketh Keep, where everything was written ahead of time (which I could prove). As such, they presumed they had been remarkably clever . . . and I could have left them with that notion, except that I'm an asshole.
I pointed out to them that, just before opening the door to the room where the secret door was located, without it seeming important I fitted the words "secret door" into something I was saying about game play in general. I was talking about dungeons and their tropes, listing off a number of them. Ten minutes later, the party - after finding everything in the room that was obvious - quite subconsciously decided to search for a secret door. When I told the party about this, I got a round of applause.
Is this fair of me to tell them? Is it fair to do it at all? In chapter 4 of my book How to Run, the chapter titled "Drama," I discussed magicians:
"A magician offers a deck of cards to the mark, asking the mark to pick one at random. This looks benign; we assume that when we draw the card, we have done so at our whim. That, however, is not the case. We have been offered the deck very carefully. It has been put artfully forward, so that one card compels the mark’s choice. The shape the deck makes in the magician’s hands, the magician’s voice, the right card directed at the right angle quite literally forces the magician’s card upon the mark. That is the ‘trick’ – that there was never a choice. We only think there was a choice because it is our nature to think everything we encounter is innocent."
If you want the players to follow a course of action, there is a greater distinction inherent in the game than 'railroading' and not 'railroading.' These things are not black and white because we as humans are not black and white. We're a mix of all sorts of complex patterns and motivations, each individual, and it takes experience and clarity to be able to guess at what can be said to players - more to the point, specific players, in specific situations, knowing how they'll react - if we want to motivate them in a direction.
Why is this fair? Because D&D and role-playing is entertainment, and like magicians, all is fair in entertainment as long as the participants don't feel ripped off. It is the blatant, obvious self-serving swaggering of DMs who stupidly show their hand rather than display a skein of cards that appeals in a particular way to a player's edification. Magicians have to design their tricks in just such a way that keeps them from getting punched out on the street; a DM must recognize and carefully present a campaign where the players all walk away feeling warm and good about themselves.
There are some players that I could not reveal my secret door trick to, ever. I don't play with that sort of player . . . anymore.
The trick for magicians and for DMs is to understand what can be gotten away with and what must never be gotten away with. Magicians have an extensive network with other magicians, which rigidly - through a sort of apprentice system - encourages the former behaviour while freezing out, coldly, magicians who get a bad reputation. DMs have the WOTC, which does not give a shit.
When we say that magicians are bad, we mean that they do not perform their tricks well.
When we say that DMs are bad, we mean that they are self-righteous, megalomanic, controlling fucks.
It is an important distinction.
If you want your mystery campaign to work, you're going to need to learn some magician tricks. You're going to need to understand your players better and you're will need to learn the art of subtlety. You will also do well to put yourself in the player's position, so that you can better understand how someone will interpret your 'clue' if they don't know anything about what it is supposed to mean.
I am sorry I can't make this easier for you. Hard things are hard, that's all there is to it. If you're willing to slave at it, however, the payoff will be worth the work.