I know Tolkien often downplayed the influence his experiences as a messenger in World War I had on his writing, but he wasn't being entirely truthful- perhaps the memories were too horrific to think about or discuss openly. But he served through most of the Somme Campaign, and saw firsthand the horrors of war and the uniquely appalling conditions in which the fighting in Northern France and Belgium took place. Without getting into a history lesson, imagine seas of shell craters full of mud several feet deep and rotting corpses and body parts strewn about. No trees still alive, only shattered stumps. No grass or bushes or even weeds, just mud and churned up soil.
He didn't try very hard to conceal the fact that the Dead Marshes especially were directly inspired by the horrors of the war in general and the Somme in particular. He showed a rare lack of subtlety in choosing to refer to an area near the Dead Marshes, at one point in LotR, as "Noman-Lands", which is so close to the infamous "No Mans Land" of WWI as to almost seem lazy.
Dreadful as the Dead Marshes had been, and the arid moors of the Noman-lands, more loathsome by far was the country that the crawling day now slowly unveiled to his shrinking eyes. … Here nothing lived, not even the leprous growths that feed on rottenness. The gasping pools were choked with ash and crawling muds, sickly white and grey, as if the mountains had vomited the filth of their entrails on the lands about.
- The Two Towers, Book IV, Chapter 2: "The Passage of the Marshes"
Other possible echoes of Tolkien's experience on the Western Front are less obvious. For example, the Orc knife Pippin uses to cut his bonds has a saw edge. British troops in WWI were disgusted by the original German bayonet's design, because the back of the blade had saw teeth, it caused gruesome wounds that were difficult to treat. There are numerous accounts of British troops mutilating German soldiers found carrying these "sawback bayonets". German high command demanded the bayonets be redesigned, but soldiers took matters into their own hands by filing off the saw teeth. On the one hand, I may be reading too much into this, but on the other hand, Tolkien would undoubtedly have remembered the infamous "sawback bayonets".
I've already alluded to the obvious analogy between the Dead Marshes and the Somme; the Brown Lands - also referred to as "Noman-Lands" bear similar comparison to WWI battlefields. Because WWI was bogged down in the trenches and mostly stationary for almost 4 years straight, and because the only way to kill soldiers in trenches without a direct assault was artillery, the same long, narrow strip of ground was subjected to an endless artillery bombardment for year after year. The shells radically altered the landscape. Plants and trees were erased from the land, and nothing but earth, mud, craters, and shattered corpses of men, horses, and trees remained. Nothing green was left after the first few weeks. This is almost exactly the way Tolkien describes the Brown Lands/Noman-Lands, and he attributes this appearance to similar causes- a great battle that once raged there. And as I have already mentioned, "Noman-Lands" is an extremely unsubtle reference to the "No Mans Lands" of WWI - the uninhabitable, ravaged strip of ground between your front line trenches and those of your enemies.
Other examples of echoes of the war that are more subtle and general: the common impression of Orcs as inherently wicked, cruel, and beastly foreigners from the east mirrors the British soldiers' opinion of the Germans, whom they usually called "Bosches" or "Huns" (the reasons why each of these names became popular is the subject of ongoing debate among historians to this day). The allies in WWI would have sympathized with Theoden's question, phrased in the movie as "What can men do against such reckless hate?", and taking slightly different form in the book. The British reformed an old alliance with France, once their most despised enemy, to conquer a greater threat from the East, and the British alliance with Belgium was also based on an all but forgotten treaty signed in the wake of the Napoleonic wars; in Lord of the Rings (at least in the movies), men and Elves reforge their old alliance after centuries of somewhat icy relations. The British and French condemned the Germans for forming alliances with what they deemed to be inferior, brutish races of savages from uncivilized and barbaric lands; the heroes of LotR feel the same way about Saruman and Sauron allying themselves with wild men, the inhabitants of Harad, and pirates. The western allies in WWI accused the Germans of committing atrocities against civilians in Belgium, though usually without cause; The forces of Sauron and Saruman actually commit such atrocities. The list goes on and on, but I will stop myself here.
All of these parallels are borne out by Tolkien's open admission that the Shire is his idealized vision of rural England before the First World War, and that the hobbits are a mythologized version of pre-war English villagers and farmers. Perhaps nowhere is this more apparent than in this passage from the prologue to The Fellowship of the Ring:
[T]here in that pleasant corner of the world they plied their well-ordered business of living, and they heeded less and less the world outside where dark things moved,until they came to think that peace and plenty were the rule in Middle-earth and the right of all sensible folk... They were, in fact, sheltered, but they had ceased to remember it.
The last battle... that had ever been fought within the borders of the Shire, was beyond living memory: the Battle of Greenfields, S.R. 1147, in which Bandobras Took routed an invasion of Orcs.
-The Fellowship of the Ring; Prologue
This is passage reflects the thinking of the pre-war British so perfectly that it could almost be mistaken for propaganda, were someone to alter a few minor details. The British had convinced themselves that theirs was a peaceful land far removed from the strife and discord of the world beyond their borders, even as they reaped the rewards of living in the seat of the largest empire in human history, which ruled 1 out of every 5 people on the planet, in large part through military might and the threat of force. Despite the fact that they were as much to blame as anyone for the outbreak of the First World War, their instinctive response to the war was to blame the Germans, Austro-Hungarians, and Russians, and cry "How dare they disturb our well earned peace and happiness, we who never trouble anyone beyond our shores, and who selflessly strive to lift other peoples out of suffering and sorrow! We do nothing for our own benefit, and break our backs to serve the less fortunate of the world, wherever they may be, and ask nothing in return. What villainy is this that drags the most generous, inoffensive, and humble nation in history into a war which we have done nothing to bring on?"
Tolkien said less than he might have about how his work was influenced by his experiences in the war, and what little he did say related mainly to minor points of detail. For instance, he admitted that the character of Samwise Gamgee was based on the humble soldiers and batmen (enlisted men who worked as servants to officers). He says these men of lowly origins routinely proved their courage and valor, much to the surprise of their superiors, and admits that he knew they were much greater men than himself.
My ‘Samwise’ is indeed (as you note) largely a reflexion of the English soldier ...the memory of the privates and my batmen that I knew in the 1914 War, and recognized as so far superior to myself..
― The Letters of J.R.R. Tolkien
And despite his occasional insistence that little of his work was related to his real world experiences, he also said otherwise from time to time:
I take my models like anyone else - from such 'life' as I know.
- J.R.R. Tolkien, Letter #181
While working on Lord of the Rings, Tolkien wrote a letter to his publisher, Stanley Unwin. The letter was dated October 1938, just after the Czechoslovakia Crisis, and amid a widespread mood, especially in Britain, of an ever increasing dread of war. Tolkien wrote that, although the story was not an allegory, the general feeling of fear and despair had seeped into his writing:
The darkness of the present days has had some effect on it.
- J.R.R. Tolkien, Letter 34
The blog "Middle-earth and J.R.R. Tolkien" has an entry titled "Is The Hobbit by J.R.R. Tolkien an Allegory?", containing the following summary:
At the end of the day we must agree that there was not only SOME allegory in Tolkien’s fiction, but that he was aware of the allegorical nature of those stories or portions of stories; and in typical Tolkien fashion he may sometimes have danced around the truth, either because he was not fully prepared to concede that his fiction was “just allegory” (which it most certainly was not) or perhaps he was occasionally somewhat impish in sharing his viewpoints with readers and commentators. I sometimes get the feeling that Tolkien found himself twitching the nose of the dragon (the stodgy academic community that often challenged his work) just to see if he could make it sneeze.
So what I am hoping for in asking this question is simple: what did Tolkien write (or say) about the connection between his writing and his experience in WWI especially, (but not limited to) the Somme?
Note 1: In his comment (below his answer), Jason Baker brings up an important point that bears repeating, and since he says it more clearly and concisely than I could ever hope to, I will quote him (almost) in full:
I don't think it's a stretch to say that Tolkien's writing was influenced by his experiences in the war. But there's a difference between the parallels that exist and the ones Tolkien will admit to; there tends to be more of the former than the latter... In general Tolkien preferred to talk about the mythic influences over the historical ones.
Note 2: For those who might think that I am imagining connections that aren't there, hee are some of the MANY articles that have been written on this subject (indeed, entire books have been written about the influence Tolkien's experiences in the war had on his work):
The Shell-shocked Hobbit: The First World War and Tolkien's Trauma of the Ring (includes a speculative diagnosis of Post Traumatic Stress Disorder (first identified - and labeled "shell shock" at the time - among soldiers who, like Tolkien, had fought on the Somme) for Frodo).
JRR Tolkien and World War I - Nancy Marie Ott
National Geographic - INFLUENCES ON THE LORD OF THE RINGS World War I and World War II
BBC - How Was Lord of the Rings Influenced by WWI?
Tolkien Gateway Entry - World War I
Why World War I Is at the Heart of ‘Lord of the Rings’
Fellowship of the Ring 60th Anniversary: How the Masterpiece Reflects JRR Tolkien's WW1 Involvement
War experiences of veteran J.R.R. Tolkien in 'The Lord of the Rings'