Why is there pain at different points of the body, like behind the right shoulder or around the collarbone, if the attack happens in the gallbladder?

Referred pain . Occurs when the body gets confused about where the pain is located. In gallbladder pain, the nerve that goes to the area is the same one that goes to the tip of scapula, so you think it is coming from there. Another example: when you get irritation of diaphragm, you get pain on top of shoulder.