The active ingredient in aspirin is acetyl salicylic acid, a synthetic form of another chemical compound called salicin. Salicin can be found in many plants, most notably the willow tree. In fact, extracts of willow were used in Greece as early as 400 B.C. to treat women's labor pains during childbirth.
Aspirin relieves pain by stopping the body's cells from making a chemical called prostaglandin. It makes the pain signals sent out by nerve endings stronger by amplifying them. The body's cells also make a protein called COX-2; it is COX-2 that takes other chemicals floating around in the body and turns them into prostaglandins. Aspirin molecules stick to COX-2 and keep it from making prostaglandins. This "lowers the volume" on the pain signals sent by your nerves to your brain. But prostaglandins also helps keep the stomach lining healthy and thick; when they are blocked, the lining can get thin and digestive juices can irritate it. This is why aspirin can sometimes upset your stomach.
Aspirin doesn't just go to where the pain is. It dissolves in your stomach and your body absorbs it into the bloodstream, distributing it through the entire body. The body gets rid of the aspirin by turning it into salicylic acid. Eventually the kidneys filter it out of the bloodstream and into the urine. The whole process takes four to six hours -- which is why we need to keep taking regular doses of aspirin to keep the pain at bay.
Aspirin can be good for other things besides pain relief. For example, it can slow down the production of clots in the blood, which can cause heart attacks by clogging the blood vessels that bring oxygen and fuel to the heart.