the chemical in aspirin is changed into an acid, and the acid, in regulated amounts, actually act as an anti-inflammatory and a mild pain-reliever. that's how aspirin works.
Aspirin basically suppress the action of prostaglandins (local hormones with in the body) Prostaglandins play major role in the transmission of pain information to the brain.
Its better not to give your animals medicine just incase if you give them the wrong dosage they could have a heart-attack and in some cases they die, but it usually varies from the size of the dog...