I don't think many can really say for certain what inspired the great battles of LOTR, but there are at least a number of parallels with real events.
The most notable being the similarities between the Battle of Pelennor Fields and the Siege of Vienna 1683.
At the time Vienna was viewed as the gateway to Europe, so when the Turks invaded, it was an essential objective. The European leaders recognized that if it were to fall, the Turkish army could advance deeper into the continent. The Attacking force was far greater and the defending garrison woefully undermanned. Sounds an awful lot like Minas Tirith.
However, a call for aid was sent out, and King Sobieski of Poland answered. Although that was also in response to an existing treaty. A relief force was also underway from the Holy Roman Empire.
When the relief force finally arrived, the German and Polish infantry set to work attacking the opposing force, which they did with great effectiveness. The Cavalry maneuvered into a better position to attack the greater Turkish force. Though the infantry were very effective, they were quickly becoming exhausted. Finally Sobieski emerged with a force of Cavalry numbering ~18,000 strong, with the Polish Hussars forming the vanguard. His charge routed the Turkish Army, and relieved the city. Incidentally his charge also has the honor of being the largest cavalry charge ever recorded.
These battles are hardly mirrors of one another, there are obvious differences. But I think it is easy to see how the battle of Vienna, it's importance to the Europe, and conclusion in a massive cavalry charge, could have inspired Tolkien's Battle of Pelennor Fields
I am not a very articulate individual, so my case may not be very convincing. But I encourage you to have a look at the Battle and determine whether or not you think there is any merit to the suggestion.
I read through both accounts and they strike me as very similar.
Hope this helps!
(also, this is a very old post, sorry about that!)