Hiccups occur due to sudden contraction of the diaphragm. The diaphragm almost always works perfectly. When you inhale, it pulls down to help pull air into the lungs. When you exhale, it pushes up to help push air out of the lungs. But sometimes the diaphragm becomes irritated. When this happens, it pulls down in a jerky way, which makes you suck air into your throat suddenly. When the air rushing in hits your voice box, you're left with a big hiccup.
Some things that irritate the diaphragm are eating too quickly or too much, an irritation in the stomach or the throat, or feeling nervous or excited. Almost all cases of the hiccups last only a few minutes. Some cases of the hiccups can last for days or weeks, but this is very unusual, and it's usually a sign of another medical problem.
You've probably heard lots of suggestions for how to get rid of hiccups, and maybe you've even tried a few. Holding your breath and counting to 10 is one way some people can get rid of their hiccups. Other people say that drinking a glass of water is the way to become hiccup-free. Putting sugar or jaggery under your tongue might work.