In The Hobbit, Tolkien presents three trolls (Bert, Tom, and Bill Huggins) who are decidedly comic figures:
They were trolls. Obviously trolls. Even Bilbo, in spite of his sheltered life, could see that: from the great heavy faces of them, and their size, and the shape of their legs, not to mention their language, which was not drawing-room fashion at all, at all. ...
Yes, I am afraid trolls do behave like that, even those with only one head each.
Then in Chapter 2 of The Fellowship of the Ring, "The Shadow of the Past", we are told:
Trolls were abroad, no longer dull-witted, but cunning ...
And indeed the once or twice that we see trolls (once in the Chamber of Mazarbul—and again near the bridge of Khazad-dûm; and once near the end of the War of the Ring, in the Battle of the Morannon—or is that the name?), they are fearsome opponents, though perhaps we don't see them long enough to decide that they are indeed "cunning".
Is there any description in Tolkien's letters or in the History of Middle Earth of how The Hobbit's trolls became The Lord of the Ring's Olog-hai?
I'd accept an in-universe or out-of-universe answer; that is, either a description of what Sauron did to effect such a change, or a description of how Tolkien changed (or perhaps did not change) his description of the encounters with trolls in either of the books.