Diaphragmatic irritation is mediated via the phrenic nerve that provides motor and sensory innervations to the diaphragm as well as to mediastinal and pleural tissues.
The phrenic nerve is derived from C3-C5 so that pain referral to the shoulder in a C4-C5 distribution is really a segmental pain referral