A shoulder that dislocates is a serious injury, and it is not something you should try to pop yourself. A shoulder (anatomically called the glenohumeral) joint is a ball-and-socket joint that allows us to rotate and reach overhead and behind our backs, but it is also prone to instability. Dislocations usually occur when the upper arm bone (humerus) is forced out of the socket, which is lined by a soft cartilage cup and ligaments that hold it in place.
Trying to push a shoulder back into its socket with force can actually damage the ligaments and capsule, making it more unstable and prone to repeat dislocations. That's why the Red Cross recommends only trying this technique in an emergency situation where medical help isn't available.
You'll need another person to help you, and a sling or piece of clothing can be helpful. The injured person should lay down, relax, and extend the arm out in front of them. Then slowly, the person should start to pull their hand down toward the nape of their neck (as if they were scratching their head). Eventually, the shoulder should pop into place and you'll feel immediate relief.
It takes about ten minutes to relocate a shoulder, and it's very important to keep the elbow straight out when doing this. Never let anyone other than a trained healthcare provider move or touch your shoulder after it dislocates -- they could cause more pain and damage the tissues surrounding the joint.