Tolkien was a linguist and he specialized in the old Norse languages, and IIRC Finnish in particular. As mentioned above he took some names directly from the epic poems he was translating to English and used them in his own writings. Gandalf literally means Big Elf. His work was seminal in the fantasy Genre, and he basically laid out the tropes for the fantasy book: start with a map, band of misfits on an adventure, destroy the dingus, go all over the map, etc. None of his work even touched on real life dwarfism. But, when Tolkien was alive and writing, the medical world was a much different place and if you saw a dwarf, it wasn't Peter Dinklage in a serious role, or Warwick Davis in costume, it was a person at the Circus or at the Freak Show.
Tolkien's dwarves are short vikings without boats.
The men of Rohan are vikings on horses
Slaying the dragon
The Hobbit and LotR is pretty much Viking Epic Fantasy.