As you have likely presumed, a question mark asks a question. But what counts as a question? That is yours to decide.
Direct questions A question mark is used at the end of a direct question: Where am I going? Informally, more question marks add emphasis, but formally, use just one. In text messages, it may be omitted to avoid sounding imposing.
Indirect questions Informally, it can also be used at the end of an indirect question (phrased grammatically like a statement but implying a question): I think so? I’m wondering where you are? It’s a useful device, but it’s not considered standard. (See Ending Sentences and Sentence Length.)
Fragments It can be used in a sentence fragment intended as a question: Sunshine?
Shorthand It can be used as a shorthand in notes for something you don’t know: After escaping Lady Violet, Rainfall was searching for her sister, and was starting by going to ?. Or The enchanted forest? Somewhere else? Or it can be used in parentheses (if you leave it in the final version) or brackets (in a draft) for uncertainty: The forest to the northeast (?) — it sometimes moved — was said to have answers.
Emphasis Informally, multiple question marks can be used for emphasis: Where is she??? Or you can use an exclamation point: Where is she?! Or an interrobang. Or just an exclamation point if the question is angry.
Uptalk Informally, it can be the written form of uptalk (which is really OK!). It can also express incredulity: They were mad at me for leaving?? After?? They exiled my sister?????
Questions within sentences See Parentheses, Comma, Quotation Marks, and Em Dash/Long Dash/Dash.
Placement It is used directly after a question (see Parentheses, Brackets, and Quotation Marks). A dash or ellipsis is sometimes used before a question mark if the speaker stops (dash) or trails off (ellipsis) mid-question, or to add some hesitation. The question mark is usually left off here, though.