Why do muscles get sore after weightlifting, a long run, etc.?

Lactic acid build up. Lactic acid builds up in muscle tissue with hard or long exercise and causes soreness. Time, rest and hydration is the cure.