一体 + [question word]
一体 goes in front of a question word and turns the question up: "what on earth", "who in the world", "why the heck". It shows surprise, frustration or plain bafflement. It is written in kanji or as いったい.
Other words can sit between 一体 and the question word, but 一体 comes first. The rest of the sentence is an ordinary question.
With だろう or んだ at the end, the question is often not put to anyone. You are thinking aloud, and the tone is exasperation more than curiosity.
As an adverb, 一体 needs a question. A statement does not take it: ×一体おいしい. The noun いったい一体 in いったいとなる一体となる ("become one") is a different use of the same word and has nothing to do with questions.
一体 works in casual and polite speech alike. The feeling behind it can still come across as blunt, especially aimed at the listener: いったい一体なん何をしているんですか is polite in form and still a rebuke. いったい一体ぜんたい全体 is a stronger, slightly theatrical version.