"Good riddles do, in general, provide us with satisfactory metaphors; for metaphors imply riddles, and therefore a good riddle can furnish a good metaphor." - Aristotle
Indeed, riddles and Riddle Games are not mere tools, mere elements, of mythology and Fantasy literature alone. Professor Archer Taylor of Pennsylvania, a a seminal proverb and riddle scholar and folklorist, says that "we can probably say that riddling is a universal art" and cites riddles from hundreds of different cultures including Finnish, Hungarian, Native American, Chinese, Russian, Dutch and Filipino sources amongst many others. Riddles have been characterized as one of the most important forms of oral art in Africa.
When people ask how I fashion riddles, this is the answer
According to Archer Taylor, "the oldest recorded riddles are Babylonian school texts which show no literary polish," such as the riddle:
My knees hasten, my feet do not rest, a shepherd without pity drives me to pasture = ?
I, personally, disagree with him as, per my own Riddle Maker mind, I judge the above riddle as perfectly respectable. My only grievance is that the answer was not preserved! AUGH!!
Anyway, regards to Fantasy books, many authors put concept of riddles and Riddle Games to use. J.R.R. Tolkien hosts a famous one between Bilbo and Gollum in The Hobbit.
In The Grey King, the third book of Susan Cooper's fantasy sequence The Dark is Rising, Will and Bran must win a riddle game to gain a...special power necessary for the Light in their war against the Dark.
In Stephen King's The Dark Tower III: The Waste Lands and The Dark Tower IV: Wizard and Glass, the ka-tet must riddle against Blaine the Mono in order to save their lives. (Of course, seeing as I have read neither of these books, this is only a secondhand account)
But, in my not entirely humble opinion, no Fantasy author makes better use of riddles than Patricia A. McKillip in her books The Forgotten Beasts of Eld and The Riddle-Master trilogy.
In the latter, the ancient art of riddlery is taught at the College of Caithnard - the study based on books recovered from the ruins of the School of Wizards. The riddles in the series are composed of three parts - the question, the answer, and the stricture - and are both a way of recording history and a guide to living life. Riddles play a crucial role in the series, the main protagonist, Morgon of Hed, beginning his journey by winning the crown of the kings of Aum in a Riddle Game with the ancient ghost of Peven of Aum; Peven had a standing wager going that no one could win a riddle-game with him, and those who lost against him forfeited their lives. (This is not a real spoiler, as the reader learns all this and more within the first chapter or two)
"Beware the unanswered riddle."
Here is a (easy) riddle I created:
What plays with words and logic, yet never tells a lie = ?