The first thing I’m compelled to do is point out that Tolkien is not the originator of modern fantasy literature. Robert E, Howard’s Conan and Kull sword and sorcery stories predated Tolkein by several years. Howard was also better known than Tolkein to the population in general. Within their lifetimes and careers (which overlapped somewhat) I think that Howard had more readers than Tolkein ever managed. That was certainly true after they died. Throughout the twentieth Century far more people would have recognised Conan than Bilbo or Gandalf. Prior to the PJ LOTR movies Tolkein it was largely unknown. In contrast Conan was genuinely popular (albeit geeky) culture with is own successful comics titles for many years in addition to the short stories and novels by several authors, a TV series and the Schwarzeneger movies. Conan in the last century was on par with Star Trek in terms of “geek popular culture” (is that an oxymoron?)
Tolkein certainly managed to elevate the fantasy genre to a more ‘classy’ place, but it already existed and was already popular pre-Hobbit and presumably would have been popular had Tolkein never lived at all. For all that Gygax and Co. stole shamelessly from Tolkein, they plagiarised Howard just as shamelessly. The Barbarian class that hates and fears magic is pure Conan. The other core concept of D&D that is pure Howard as is the concept of wizards needing time to gesture flamboyantly and use ingredients. That gives the sword wielding hero time to run across the floor and disrupt the spell, a device used many times by Howard as well as the Conan comics lines.
The reason I think it’s important to realise that modern fantasy didn’t start with Tolkein is because Conan, Kull and Red Sonja were also wandering around in faux-Medieval times (though often the Hyborian age seems more like Hellenstic Greece/Classical Rome politically). And of course Howard’s fantasy initially appeared in that great harbinger of geek culture: the pulp magazine. The pulps not only gave us fantasy but Sci-fi, the Cthulhu mythos and the western. They really were the breeding grounds for 20th century geekdom. The uber-point being that the medieval setting was already a fixture of geek culture before the Hobbit was published.
So why the Medieval period? Well as a mildly geeky person (who was much geekier when younger) I can say that Tolkein ain’t the reason. I was already enthralled by magical medieval settings long before I discovered Tolkein at 13. I promply became a devoted fan of Tolkein and thereafter of RPGs, but that was because they were the medieval magical settings I loved, not the cause of that love. I was enthralled by the Greek and Roman myths from the time I first read them as a very young child in picture book form. I read a Conan novel when I was about 10. I devoured the Narnia series. And I think these experiences would be pretty typical of those of us who like this sort of Medieval geekery. Narnia, classical mythology, Authurian legend and the Gummi bears formed a pattern that Tolkein and D&D slotted into. Tolkein and D&D were in now way the cause. They were selling to a market that already existed.
It’s very hard to articulate why I was drawn to medieval fantasy, and in reality I think that there were lots of reasons that sort of came together in that genre. Part of it was the depth of the genre. These weren’t isolated characters, these were whole other world. Jason turned up in unrelated stories and talked to Odysseus, Atlas turned up and talked to Hercules and so forth. These characters all knew each other and all were interwoven. To a boy who had a mind that loved to categorise the world this was fascinating. It was a whole new world to categorise, but a simple one, so much easier than messy reality. So in that sense it appeals to the smartarse in me, and most geeks are smartarses in the sense that we know that we’re clever and like everyone else to know we are too.
The other big drawcard was the limitless horizons and infinite capacity for problem solving. I was a very bright child (shame it never extended into adulthood ) and quite frankly a lot of the world bored me. School seemed to teach things exceptionally slowly (though I wouldn’t have been able to articulate that at the time). I felt that everything had an answer and every problem had a solution but that I wasn’t being taught what it was fast enough to put all the pieces together. Magical fantasy solved that problem. In that world the hero can wave his hand and solve the problem with magic. There’s no need to worry about annoying details, there is a problem and there is a complete solution. I envied those characters that lived in a world where the solutions could be so unambiguous. Cowboy novels and other genres can have perfect solutions, but they can never be as total as the labours of Hercules or Bilbo: there are a million bandit gangs but once you eliminate the Symphalian birds or killed Sauron you’ve done it forever. You’ve changed the world forever, not just made it better for a little bit
The other thing was that the heroes in these stories are special. They aren’t just talented or hardworking or brave like the people in detective or cowboy stories, they have genuine special talents from the Gods or wherever. That definitely appeals to the geek in me. I think all geeks think they have special gifts, especially adolescent boys. Some grow out of that belief more than others.
Of course all those things could apply to other genres, but it’s hard to combine them as seamlessly as fantasy literature does. Cowboy novels can have easy solutions but never total solutions because they are tied to the real world. For the same reason superhero can have special abilities but suffer form the same problem as cowboys. Sci fi characters can change the world, but they don’t have special abilities (a notable exception being the Star Wars style fantasy where the hero did indeed have special magical powers, and became a geek icon as a result).
So IMO fantasy literature just happens to be a convenient place to blend a whole lot of geek attractive traits into one consistent whole.