They vary quite a lot. The basic ones - but still usually good - are just a sort of springy steel that clips onto the neck of the jack plug. In itself, that part can be bent so that the clip action is stronger, although if you go too far, the plug jams on that part of the mechanism.
A problem I've found is that occasionally the neck on the plug is quite thin, and the contact is only over a small area. The 'click' is obviously the end of the jack locating on the springy steel part. Some sockets that are enclosed are not easy to adjust. Some of these are switched sockets, which have another spring loaded contact.
Using quality plugs is obviously a good solution; I found Neutrik about 30 yrs ago and never use anything else. And, they make a really good switched jack that saves the 'thunk' every time the plug is inserted/taken out. Invaluable for electric guitar teachers!
Here's a picture of a basic jack and plug that shows how the plug is retained in the jack: