'Well,' said Frodo, standing up and drawing his cloak more closely round him. 'You sleep for a bit, Sam, and take my blanket. I'll walk up and down on sentry for a while.' Suddenly he stiffened, and stooping he gripped Sam by the arm. 'What's that?' he whispered. 'Look over there on the cliff!' Sam looked and breathed in sharply through his teeth. 'Ssss!' he said. 'That's what it is. It's that Gollum! Snakes and adders! And to think that I thought we'd puzzle him with our bit of a climb! Look at him! Like a nasty crawling spider on a wall.'
Down the face of a precipice, sheer and almost smooth it seemed in the pale moonlight, a small black shape was moving with its thin limbs splayed out. Maybe its soft clinging hands and toes were finding crevices and holds that no hobbit could have ever seen or used, but it looked as if it was just creeping down on sticky pads, like some large prowling thing of insect-kind. And it was coming down head first, as if it was smelling its way. Now and again it lifted its head slowly, turning it right back on its long skinny neck, and the hobbits caught a glimpse of two pale gleaming lights, its eyes that blinked at the moon for a moment and then were quickly lidded again.
'Do you think he can see us?' said Sam.
'I don't know,' said Frodo quietly, 'but I think not. It is hard even for friendly eyes to see these elven-cloaks. I cannot see you in the shadow even at a few paces. And I've heard he doesn't like the Sun or Moon.'
The black crawling shape was now three quarters of the way down, and perhaps fifty feet or less above the cliff's foot. Crouching stone-still in the shadow of a large boulder the hobbits watched him. He seemed to have come to a difficult passage or to be troubled about something....
Only here, while he is inside the head of a desperate, frightened Bilbo who is contemplating murder, does the narrator refer to Gollum as it. It's as if Bilbo, whom the narrator has explicitly said 'could not find much pity [for Gollum] in his heart' (92-93), is trying to keep Gollum's humanity at sword's length here. He fails. And the transition from it to he marks that failure: 'And he was miserable, alone, lost.' Every prior he in this paragraph refers to Bilbo. The sentence could equally well describe him at this moment. And that instant of indeterminacy allows pity to come flooding in. The paragraph and the history of Middle-earth both pivot on this shift of pronoun.Bilbo almost stopped breathing, and went stiff himself. He was desperate. He must get away, out of this horrible darkness, while he had any strength left. He must fight. He must stab the foul thing, put out its eyes, kill it. It meant to kill him. No, not a fair fight. He was invisible now. Gollum had no sword. Gollum had not actually threatened to kill him, or tried to yet. And he was miserable, alone, lost. A sudden understanding, a pity mixed with horror, welled up in Bilbo’s heart: a glimpse of endless unmarked days without light or hope of betterment, hard stone, cold fish, sneaking and whispering. All these thoughts passed in a flash of a second. He trembled. And then quite suddenly in another flash, as if lifted by a new hope and resolve, he leaped.(The Hobbit, 97)
Bilbo is of course the (original) narrator here, just as Frodo is in the passage from The Lord of the Rings above. Frodo has also previously felt no pity for Gollum (FR 1.ii.59), but will presently have an equally important change of heart (TT 4.i.615). The choice of language in both cases reflects the tension of the moment in each narrative (note also the use of 'thing' to describe Gollum in both texts): Bilbo facing a horrific choice; Frodo about to face the same choice.
My other observation may be made more briefly. In Bram Stoker's Dracula Jonathan Harker several times witnesses the Count crawling headfirst down the wall of his castle (Chapter III, diary entries for 12 and 15 May; Chapter IV, diary entry for 29 June). The two descriptions do not resemble each other in any particular other than that they describe the same action, so I would suggest that any influence would be limited to the suggestion of the idea. Stoker's book was quite well thought of in Tolkien's youth, and very popular from the 1920s onward. So it is possible he knew it. The scene is also quite creepily memorable. I read it when I was 10 years old and never forgot it, despite the fact that I didn't read it again for over 40 years.