How do prostaglandins cause pain?
They do not cause pain directly, but increase the sensitivity of pain spinal neurons.
They achieve this by altering the membrane ion channels on those neurons. This can happen by the binding of prostaglandins directly to channel proteins or by binding to membrane receptors that trigger a secondary messenger cascade.
Triggering secondary messenger cascade has the potential influence gene transcription. Thus, causing long-term alterations to these neurons that, on the long run, will effect their properties and their ability to transmit pain.
Further reading & source: A Dray. Inflammatory mediators of pain. Br. J. Anaesth. (1995) 75 (2): 125-131 doi:10.1093/bja/75.2.125