I believe you are refering to the expression or interjection: "How on earth" and "what on earth".
These have no special additive meaning to the sentence. They are typically followed with a main clause, like "How on earth did you do that?" or "what on earth are you doing?" They both can be simply said as, "How did you do that?" or "What are you doing?". It is used to show surprise, just like "Oh my goodness (god)."