What is involved here is the distinction between restrictive and non-restrictive relative clauses.
A restrictive relative clause is called that because the clause restricts the scope of what is said about the noun or noun phrase it modifies. It specifies which noun is meant.
In your case, if which is inserted into the hole close by her is a restrictive clause it means that John connects the sling to a cam in that position and no other.
If it is a non-restrictive clause, then the position of the cam is irrelevant. It is just by happenstance that the cam is there.
The role of the comma is to distinguish these two sorts of clause: a non-restrictive clause is set off by a comma (or two, if it falls in the middle of the sentence), a restrictive clause is not.
RESTRICTIVE: John takes a long sling, connects its one end to the cam which is inserted into the hole close by her and connects the other end to the climbing rope.
NON-RESTRICTIVE: John takes a long sling, connects its one end to the cam, which is inserted into the hole close by her, and connects the other end to the climbing rope.
NOTE: I myself would put a comma after by her in both sentences, to make the structure clearer; but that is not required, and here it might confuse you, so I have left it out.
There is one other clue to whether the clause is restrictive or non-restrictive: if the relative pronoun which introduces the clause is that, the clause must be restrictive. The relative pronoun that cannot be used at the start of a non-restrictive clause. Who or which, however, can be used with either sort of clause.
For about the first sixty years of the 20th century it was fashionable among some "authorities" to require that at the start of all restrictive relative clauses; but that "rule" was never widely followed and is now disappearing just as fast as it arrived. Grammar Girl is one of those who maintains it. But if you are taking a class in English, do as your teacher tells you -- until you have passed all the exams!
NOTE: Here I give my reasons for almost never using that as a relative pronoun; but you are no more bound by my practise than by Grammar Girl's.