D&D was largely inspired by Burroughs, Howard and Lovecraft, but at around the time of the commercial publication of D&D LotR suddenly became hugely popular in the US, so some Tolkien stuff was added in, in pretty much the same way that stuff from Harry Potter, Fourth Wing etc have been added...