Can staying hydrated help alleviate headache symptoms, and why?

Can staying hydrated help alleviate headache symptoms, and why?