Yes, the same painkiller can be used for different conditions but what we find is that they are marketed differently for the various age groups and types of pain.
Take ibuprofen for example. There are numerous over the counter versions that are in different packaging. e.g. some ibuprofen preparations are geared towards women with period pain while others are marketed for sore joints or a headache. Obviously the manufacturers advertise in completely different magazines and advertising mediums but when you swallow the tablet or capsule it dissolves in the stomach and is absorbed into the blood stream via the small intestine. When it's in the bloodstream, then it acts on the pain. Some preparations may be long acting and dissolve slowly over time while others may be in liquid form and work faster.
We do find however that some headache medicines work better in different individuals. Why does one preparation work for one person and not another?
Could it be partly the placebo effect? Psychologically, the person has great faith in one preparation and yet it has the same ingredient as another which has little effect. These are differences that scientists have difficulty understanding.