I'm 39 and at nite sometimes I have hotflashes and some sweat. What does this mean?

Menopause. It sounds like you might be entering menopause. Especially if this is close to the age your mother went through menopause as daughters often follow their moms in this regard. This can be treated with hormones or medicine like Clonidine or nothing at all depending on severity. See your doctor to discuss.
?perimenopause. Could be that you are getting close to menopause, can have hot flashes and night sweats for up to 10 years before menopause. Other things that can give these symptoms are infections, medication and other hormone problems.
Thyroid/menopause. The two most common possibilities would be perimenopausal symptoms, and hypotyroidism. Your doctor could evaluate the symptoms with a few simple blood tests.