Plug the "female" end of the XLR plug into the end of the microphone or other audio device. Push the XLR connector in until you hear an audible "click' and the latch release locks into place.
Plug the "male" end of the XLR cable into an XLR input on a PA system or other audio hardware, again pushing firmly until you hear a click. As noted, if the latch does not make an audible click, the XLR is still prone to coming loose.
Tug on the end of the XLR cable with gentle pressure to test the connection. If the XLR does not come loose by pulling on the cable with slight hand pressure, the latch is functioning properly ad it will now be much more difficult to accidentally dislodge the XLR cable.