First let's take a look at two passages from Book Four
Things would have gone ill with Sam, if he had been alone. But Frodo sprang up, and drew Sting from its sheath. With his left hand he drew back Gollum’s head by his thin lank hair, stretching his long neck, and forcing his pale venomous eyes to stare up at the sky.
‘Let go! Gollum,’ he said. ‘This is Sting. You have seen it before once upon a time. Let go, or you’ll feel it this time! I’ll cut your throat.’
Gollum collapsed and went as loose as wet string. Sam got up, fingering his shoulder. His eyes smouldered with anger, but he could not avenge himself: his miserable enemy lay grovelling on the stones whimpering.
TT 4.i.614
and
About an hour after midnight the fear fell on them a third time, but it now seemed more remote, as if it were passing far above the clouds, rushing with terrible speed into the West. Gollum, however, was helpless with terror, and was convinced that they were being hunted, that their approach was known.
‘Three times!’ he whimpered. ‘Three times is a threat. They feel us here, they feel the Precious. The Precious is their master. We cannot go any further this way, no. It’s no use, no use!’
Pleading and kind words were no longer of any avail. It was not until Frodo commanded him angrily and laid a hand on his sword-hilt that Gollum would get up again. Then at last he rose with a snarl, and went before them like a beaten dog.
TT 4.iii.635
The second of these threats, which took place the night before they reached the Black Gate, is far different than the threat he made in the Emyn Muil. There Sam’s
life was clearly in jeopardy, and Frodo’s response justified (TT 4.i.614).
Yet had he simply struck Gollum down without warning in defense of Sam, not
even Gandalf could have said that he was ‘eager to deal out death in the name
of justice, fearing for [his] own safety’ (TT 4.i.615). To use violence,
however, or the threat of it merely to compel obedience is an act of terror
more suited to an orc chieftain, like Uglúk in Book Three, or to a
master of slaves, like Sauron, than it is like the brave hobbit who would not
abandon his friends in the barrow a few months earlier, or who held out to Gollum
the hope that Sméagol might be found again only a little while after he had
threatened him to save Sam’s life. Between that threat and that hope came pity;
between that hope and the latter threat came the increasing burden of the Ring, which
was made to dominate others. Much
is in flux within Frodo as the Ring pulls him one way and his sense of his
mission pulls him the other. Within Gollum, too.*
________________________________
*This paragraph is adapted from a chapter in a much larger work I am writing called (at least for now): To Rule the Fate of Many: Truth, Lies, Pity, and the Ring of Power.