Sassee, the essence of a good mystery story is that reason triumphs over evil. Reason somehow reasserts justice and social order which otherwise evil was threatening to corrupt or destroy. Murder is the ultimate vehicle for this evil because it's an irreversible, annihilatory act. By contrast, robberies say are reversible so the stakes aren't as high.
The two general types are 'whodunnits' (where the reader doesn't know the culprit until late in the story), and 'howcatchems' (where the reader knows the culprit early, and watches the hero move toward finding and trapping them). Both can make gripping drama, but whodunnits tend to be written from just the hero's viewpoint, while howcatchems tend to be written from the villain's too.
You will want a wounded hero to investigate the mystery (without a wound there's no internal tension). The hero should be someone we respect (even if we don't like it), so competent in its own life (even if inexperienced as an investigator) and survive by its wits. It should also be sexually desireable, marriagable etc...
You'll need a villain -- a culprit who acts from fear, avarice, revenge, pride or a similar failing. Whether smart or dumb, the villain must also be capable.
I recommend that you write the backstory from the villain's perspective
before writing the investigation. That way, whatever the investigator finds will makes deep character sense to the reader.
For red herrings, consider: characters who had motive to commit the evil, but not the means or opportunity; characters who had means and opportunity, but no motive; characters who have reason to lie, hide evidence and interfere with the investigation; characters who are framed; and copycat villains.
Also, ensure that the motive of the villain is inobvious but compelling. You may or may not choose to obscure the means or time of the crime too, but the motive should only be revealed to/discovered by the investigator late in the story. Else the tension deflates and the investigator doesn't look clever.
Also important is a dependent character -- one with strong audience sympathy -- who will suffer if the mystery is not solved. It's never enough that the hero suffer alone. The dependent could be a child, a witness, a love-interest, a future victim, a relative, or someone falsely accused.
Mysteries live or die by suspense, so it's important to keep the tension rising and outcome uncertain. This means that the stakes must rise over time, and not remain flat. For that you need an antagonist -- someone who doesn't want the line of investigation to proceed, and an increasing cost if the hero fails. That can sometimes be the culprit, but it could also come from the investigator's environment (e.g. a rival investigator, or someone powerful with a stake in the allegations). The rising stakes will affect both the investigator and the dependent.
James N. Frey suggests a five act format as the basic mystery story structure:
Act I: How the hero accepts the mission
Act II: How the hero is tested and changes, 'dies' and is 'reborn' (as the hero who can solve the mystery)
Act III: How the hero is tested again and this time, succeeds
Act IV: How the hero traps the culprit
Act V: Impact of the conclusion on the major characters
There are possible variants on this too of course -- e.g. if there are more than one mystery.
There are lots and lots and
lots of tropes for mysteries. In particular:
- Tricksters -- characters who distract and mislead for their own ends
- Mentors -- characters who guide and provide advice
- Wizards -- who provide special boons (e.g. forensic or computer magic)
- Wise Fools -- characters who often know something important, but are either not credible, or their knowledge is inobvious
- Maidens, Matrons, Crones and Whores -- Help, heal, tempt, seduce or curse the hero
- Wounded Knights, Mad Kings, Evil Viziers -- Test the hero's courage, wit, honour
- The Common Man or Peasant -- Reflect the 'ordinary person's' view of the problem
- Fogs/Woods/Mazes/Traps -- places or situations that leave the investigator bewildered
- Death-traps -- traps that may result in the death of investigator or dependent
- Moral traps -- dilemmas in which the investigator must choose between saving the dependent (or innocents) and solving the
mystery/trapping the villain
- Near-death experiences for the hero
- Transformations -- the hero gets a haircut, a pedicure, new clothes, stops drinking, takes the gun down from its peg ... often after a near-death experience
- Travel -- hazardous journeys to exotic and often dangerous locations
- Riddles -- puzzles that must be solved before the villain can be identified or caught
- Trophies of conquest
If this looks like a list of fantasy adventure tropes, it is. The same mythic stuff adapts to the mystery genre and is used
all the time. The quality of the story is largely unconnected to avoiding tropes, but rather in using tropes ingeniously and credibly. The main difference between fantasy and mystery is that fantasy often resolves itself by emotion and relationship, while mystery drives a conclusion from reason (and any emotion/relationship stuff is generally subplot).
So don't listen to people who say you have to be a mystery reader to write mysteries -- it ain't so! Reading great mysteries helps of course, but a good fantasy or romance writer can write a credible mystery as long as they can think in abstract, logical terms as well as emotionally.
Hope that this helps!