James Maliszewski, in his ever interesting blog Grognardia, makes an interesting post here stating what grognards have been saying for a couple of decades now: E. Gary Gygax was not primarily influenced by The Lord of the Rings when he wrote D&D. I believe it, and it's true for what it's worth when we are discussing Gygax's taste in fantasy novels.
But it isn't true of the phenomenon we understand as "D&D." Gygax wasn't just tossing in some random elements from one source when he included Elf, Dwarf, and Hobbit as races and Orcs, Balrogs, Nazgul and Ents as monsters in his game. While his contempt for some of them was pretty naked, and elaborated in many subsequent articles and interviews, it's disingenuous to say that this was just equal to dozens of other elements he added from other books. These elements were, in reality, anything but coincidental, and have dominated despite Gary's clearly stated intent otherwise.
Including elements from Lord of the Rings was decisively different from any other major elements of D&D. They were strategic, because — let me be blunt here — they were much more popular than fantasy of the type preferred by Gygax. LotR took fantasy out of the "pulp" magazine and put it into the paperback book. D&D was released at a point in time when Tolkien became popular that the utterly hacklike Sword of Shannara was published just because it was like Lord of the Rings. This was clever marketing on Gygax's part, as well; by injecting Tolkienesque elements in the game, he made it relatable to a much larger audience than the pulp fantasy connoisseur like himself. To go out on a limb, I don't think D&D would've been nearly as successful if it weren't so easy for an aficionado of The Hobbit or Lord of the Rings to slip into it with familiar assumptions.
The influence is really straightforward when you look at the secondary literature of the time, such as Alarums & Excursions, where broad swaths of Tolkien were simply assumed to be good coin in D&D because the game had included so many of its core elements. There are articles that assume larger groups of Tolkien influence, such as the Dunedain, and incorporated it much more knowledgeably than, say, the large chunks of Poul Anderson's Three Hearts and Three Lions (one of the seminal books for D&D). Eventually, despite Gygax's warnings about humanocentrism in the DMG, demihumans assumed the central role of the game, and in the Wizards of the Coast editions, they are more prevalent than humans, at least for anyone with any sense.
Now, I want to be clear that I'm a D&D humanocentrist. I find elves, hobbits and dwarves very dull after nearly a decade and a half of gaming, and could do with never seeing another pointy ear in my game. I also tend to use orcs sparingly, favoring goblins, kobolds, and hobgoblins at the lower levels. But dealing honestly with D&D as it really played out over the last 35 years, I have to acknowledge that the Tolkien elements played a tremendous role in popularizing the game and are a part of our history that we have to own, even if (like thieves and skill lists) we don't use the blasted things.