Apologies for repeating the previous stuff (AB Ed plese delete!) Here's what I meant to say:
NSAIDs know nothing, but the chemicals enter the blood stream either through the stomach if swallowed, through the walls of the rectum if administered as a suppository, or directly if injected intravenously. Once there the active ingredient is directed by the blood flow to the damaged tissue. Blood flow increases around injury sites and hormones produced by various glands alter the way the body works. For example, muscles can contract strongly where a bone or joint is compromised. The balance of circulation alters, depending on the severity of the injury or disease.
Damage to tissue, due to trauma or infection for example, causes the production of chemicals called prostaglandins. These are made inside damaged cells and leak out through the ruptured cell walls. Prostaglandins act on nerve endings so that a signal is passed along a series of nerve cells to the brain where the signal is interpreted as pain. Prostaglandin is present in the brain during pain and it seems to be instrumental in the transmission of pain signals across synapses, the junctions between nerve cells. Non-narcotic analgesic drugs block prostaglandin production so that the nerve endings are not stimulated. In addition Asprin, and to a larger extent NSAIDs reduce swelling and inflammation in the damaged cells. The active ingredients only act on damaged cells, even though they may be transported throughout other parts of the body. Because of the increased blood flow to damage sites this effect is enhanced. Furthermore, topical application can direct the drug to the correct region, for example the use of suppository for lower back or pelvic pain, or injection into joint tissue.