Gollum began following the fellowship of the ring fairly early on, something that Frodo became aware of shortly after they became trapped in the mines of Moria. Gandalf assured Frodo that he wasn't worried about Gollum, and that Gollum might yet have a part to play in the ring's story.
Frodo and Samwise eventually broke away from the fellowship and struck off for Mount Doom in Mordor. Gollum continued to follow them, and eventually joined them as their guide to Mordor.
Sam never trusted Gollum and kept a close eye on the troubled creature. Gollum didn't trust Sam and did whatever he could to create a rift between Sam and Frodo.
Westland created the Gollum and Sam salt and pepper shakers as a recreation of the mistrust Sam had of Gollum. You can see Sam crouching behind a rock, watching Gollum who is having a moment of insecurity. It is beautifully painted and has a magnet that keeps them in the position you see here.