The dermatologist will be able to tell you - I know it's frustrating.
If the dermatologist can't identify it completely or can't clear it up fully (we had this issue with one of our kids) - an allergist can help. If they work together, even better.
In our case, we didn't have that - so we had to put two and two together. Sometimes it takes a while. Allergist often can look at skin and they've seen it all. So even though they are identifying allergies, they see the skin results that go along with it.
Hopefully it's not that involved. My kids have all had rashes and they've had contact dermatitis. Mine have done hydrocortisone, I think it was, in low percentages and that usually clears it up within a few days.
We use scent free, dye free products and rinse hair/skin/clothes really well. That was key. No lotions except for hydrous emollient (scent free - comes in a big tub at pharmacy).