Drink plenty of water. Dehydration can lead to a headache, especially if you've vomited recently or you're hungover. Drink a tall glass of water as soon as your head starts to hurt, and try to continue drinking small sips throughout the day. You should gradually feel the pain start to ease.
Water, rest, and dark places always help me. Putting a cold washcloth on your head... works great. Avoid screens, loud noises, bright/flashing lights, etc.. Just try and stay away from stimulation in general.
If you get headaches a lot, you should try and work on reducing your stress level... migraines run in my family, and working on shutting down my stress has increased the sparsity of them from every few weeks to every few months.
The cause of a headache is lack of fluids in your blood, dehydration. It is exactly like a hangover. When you are low on fluids your blood thickens and once in your brain it causes pain. Solution, drink lots of water. It takes 25 quarts of water to re-hydrate the body to the fullest, believe it or not.
You can try resting with an icepack on your head. Or there is a trick where you apply pressure on the part on your hand between your thumb and pointer finger and massage it. It can depend what type of headache you have.
Almost everything on here is a good way to get rid of it. Another thing you can do is massage the pressure points on the head. There is one on your forehead just above the brow area in the very center, apply pressure. You should be able to feel a little crevice there for your finger to press, the harder you press the more it relieves the pain. You can also massage your temples. In some cases you may get a headache from an illness or allergen, if so you can massage around the nasal area (this will also help if you have a stuffy nose). Start by taking your thumb and pointer finger and rubbing those down along your nose from the bridge down to the nostrils and out, then you can do this in reverse and rub to the sides of your nose.
I would say try to de-stress, practice deep breathing, and use a cold compress. However, headaches can also be the result of spinal misalignment. I'm a Vancouver chiropractor and I treat people for headaches, which are typically from stress and tension in the shoulders that constricts the muscles in the neck. Check out this YouTube video that illustrates neck and shoulder stretches (it could be a huge help if you practice them on a daily basis): http://youtu.be/9dDUxFoSXiA
My strategies are to lay down in a quiet, dark room, try putting something cold on your forehead (not like ice, just like a washcloth soaked in moderately cold water). There is also a pressure point on your hand, in the skin between your thumb and forefinger, that you can press to relieve headaches.