Tolkien worked on his invented languages for years, the same way that you or I might do literally anything else. He developed progenitor languages and daughter languages and filled everything with complex vocabularies that changed over the fictional eras he was writing about. This impossibly heavy nerd-lifting paid off in a bit way when he eventually wrote The Lord of the Rings, as by that point he already had a massive world with a rich history to set it in. Much of the history itself would end up in his later work, The Silmarillion.
Which reads a little bit like getting hit in the face by an encyclopedia.
In short, it's not a great exaggeration to state that the greatest fantasy epic ever written owes much of its success to the hard work a lunatic put into talking to imaginary friends. So if you enjoyed The Lord of the Rings for the adventuring, or the battles, or the woman shunning, you were wrong and missed the best part. The best part was the singing around the campfires.