There is something alluring to putting a riddle in your story, especially in fantasy. Heck, that goes back to The Hobbit and the riddle game between Bilbo and Gollum. But making a good riddle, that's another matter.
I recently read a book-- no need to go into specifics-- but the underlying premise involved solving riddles to get to the end goal. And in it, people were downright stumped by said riddles. For months on end. Thus the author was telling us that they were super hard.
Except I solved each riddle within moments of reading them. So, at least for me, the foundation the book was built on was extraordinarily flimsy.
But on the other hand, you don't want your riddles to be so hard they're based on a logic that only a madman could get from A to B to C, and then realize that "C" means "see", and you need glasses to see, and glasses are kept in the cabinet, and therefore The Riddler is going to assassinate the President's Cabinet!*
So, having your puzzle actually make logical sense is crucial. But the great thing about logical puzzles is they can seem like complete crazysauce, because Pure Logic rules don't really apply to the real world. Take, for example, the "100 Green-Eyed Dragon" puzzle. The nature of the puzzle is extremely convoluted, involving several rules and caveats to enable it to work the way it does. I won't give you the answer, but I will say that the answer only works because it's a matter of Pure Logic, including the caveat that every dragon involved operates on pure logic, and they also know that every other dragon involved also operates on pure logic. Take that presumption away, and the whole house of cards falls apart.**
Of course, much of the fun of putting riddles or puzzles in a story is having your characters go through the process of solving it. If you can work it that A. your (average) reader hasn't already figured it out and B. after going through the process with the character they will think, "Yes, that makes sense now.", then you've succeeded.
What are some of the riddles you have in your stories?
*- This is not an actual example of The Riddler's riddles on the old Superfriends show, but it more or less fits the train of logic to get to the actual intended answer the show had.
**- Another example is the Prisoners and Hats puzzle. Quick version:
three prisoners are sentenced to be executed, but the jailer will let
them go if they solve a puzzle. He has four hats: two blue and two red.
He lines them up and puts the hats on their heads, so no prisoner can
see his own hat, and the second prisoner can see the first, and the
third can see the second and first. Now, the the solution comes from
the fact that if the third prisoner sees two hats of the same color on
#1 and #2, he immediately knows he's got the other color, and says so.
But if he sees #1 and #2 have different colors, then he knows nothing
about his own hat. However, #3's silence would indicate to #2 that his
hat is different from #1, so he can figure it out. That's the solution,
but it's entirely based on the idea that #3 isn't an idiot, and that #2
also isn't an idiot, AND he knows that #3 isn't an idiot. Poor
prisoner #1, of course, has no information and has to rely on the both of these two, praying that they aren't idiots.