Tolkien was a scholar of philology and deeply loved language and mythology, considering the two inseparable. He specialised in Old Norse at university, worked for the Oxford English Dictionary, became a Reader in English Language at the University of Leeds, and became a professor of Anglo-Saxon at Pembroke College, Oxford University. He learned Latin, French, German, Middle English, Old English, Greek, Finnish, Italian and Welsh, and was familiar with many more languages. His particular interest was Germanic languages, and he developed a great love for Finnish.
When creating the different cultures of Middle-earth, Tolkien constructed a rich mythology and language for each. His main Elvish languages are Quenya and Sindarin, with Quenya being mainly a ceremonial language by the Third Age, equivalent to Latin today (Tolkien sometimes referred to Quenya as ‘Elven-Latin.’) Quenya was influenced mainly by Finnish, which Tolkien had been so impressed by, but also has elements of Latin and Greek. Sindarin, the more commonly spoken Elvish language by the time of The Lord of the Rings, is influenced primarily by Welsh. The Black Speech, found on the Ring, was created by Sauron and is spoken in Mordor, designed by Tolkien to be an unpleasant, ugly language. Another language of Middle-earth is the Dwarvish language Khuzdûl, influenced by Hebrew.
Tolkien also invented scripts for his languages, which are sometimes shown in the book. Tengwar is the beautiful flowing script written on the Ring (though the actual language is the Black Speech). This is the script that Elvish is usually written in.
A National Geographic article suggested that a deep sadness over the loss of languages and cultures from our world is reflected in The Lord of the Rings, with the passing of the elves and the loss of their culture and knowledge. The article states that there are now only 6,000 languages left in our world from a possible 10,000, and that this number could easily fall as low as 3,000 in the next hundred years. Read the full article here.