Michael's answer is good, but I'll submit this anyway in case the examples/details are useful.
I don't know if there are useful, precise, rules on all/any of these things, but I'll give some examples.
Note: there are people who insist that ending a sentence with a preposition is wrong, but it is exceedingly common for people to ignore that rule, so there generally ends up being two correct ways to phrase most of the statements below, and where relevant I have marked both of them as correct.
“He did it.”
Ⅰ-Ⅰ “For what?”
― Ⅰ-Ⅱ “He did it for what?”
- This is asking the speaker to repeat what they said, perhaps because the listener didn't hear, or perhaps because the listener can't believe it. The emphasis goes on the 'what'.
Ⅰ-Ⅲ “Did he do it for what?”
Ⅰ-Ⅳ “What he did it for?”
― Ⅰ-Ⅴ “What did he do it for?” (equivalent to 'Why did he do it?')
Ⅰ-Ⅵ “For what he did it?”
― Ⅰ-Ⅶ “For what did he do it?”
- I'd expect another word there though, like:
- For what time did you set the alarm?
- For what reason did you destroy my food-cart?
- For what country did you conduct out your espionage?
- Note that all of these sound a little stiff/formal to me, as compared to:
- What time did you set the alarm for?
- Why'd you destroy my food-cart?
- What country were you spying for?
“You pick up the box.”
Ⅱ-Ⅰ “Of whom?”
Sorry, but I would say that none of those make sense with 'box' - 'of whom' is used more to mean something's make-up. If something is "of someone", it's saying that it's made up of that person in some way. You can have a picture of Alice, a statue of Bob, a memory of Dan - but a bookcase of Carl implies you literally made a bookcase out of Carl. Most people wouldn't understand what you meant, unless it were a statement in some mildly comedic horror movie/game/book.
Note (for added detail/confusion) that 'a bookcase of wood' is grammatically correct, but kinda strange - we'd usually just say "a wooden bookcase". We'd never say 'I took an Alice picture' though, unless it were explicitly in mockery of the english language.
So if we're talking about taking a picture with a camera, we might say:
― “Of whom do you want me to take a picture?”
or (more commonly and casually)
― “Who do you want me to take a picture of?”
― “You want me to take a picture of who?
- (this phrasing generally implies that the speaker is incredulous at the person they've been asked to take a picture of, or is asking for clarification.)
If the question is about the person that box belongs to (or, if you feel pedantic, 'the person to whom the box belongs'), then we'd phrase it like so:
― Ⅱ-XIII “Whose box did you pick up?”
“This'll stabilize the value.”
Ⅲ-Ⅰ “Of what?”
― Ⅲ-Ⅱ “This'll stabilize the value of what?”
- (Works, but implies that the asker is requesting clarification of something they've already heard.)
Ⅲ-Ⅲ “Will this stabilize the value of what?”
Ⅲ-Ⅳ “What this'll stabilize the value of?”
― Ⅲ-Ⅴ “What will this stabilize the value of?”
- (When spoken, the first two words may get contracted to "what'll")
Ⅲ-Ⅵ “Of what this'll stabilize the value?”
Ⅲ-Ⅶ “Of what will this stabilize the value?”
This ^ last one is one of those 'sorta grammatically correct' sentences that just doesn't sound right.
But even the corrects ones sound a little off for 'value'. In any situation I can come up with, we'd phrase it more like:
― Ⅲ-IX "What value will this stabilize?"
I'd use Ⅲ-Ⅴ if we were talking about, say, someone overhearing half a conversation, asking to be caught up:
(Alex is swinging a doll around vigorously)
Becca: Stop! You'll tear off the arms!
Carol (overhearing Becca, but not seeing Alex): What will he tear the arms off of?
I'm actually not sure what Ⅲ-Ⅷ through Ⅲ-XIX are trying to say. I'd say none are really correct as-is, although some could be made grammatically correct in one way or another by minor edits, depending on what they're trying to say.
Do you mean the value of ____?
Means offering a gentle correction to something someone said.
Alice: "Phil just sold his stash of silver last week to buy 10 pounds of gold, but he'll be upset when he sees how much the value of gold went up this morning"
Bob: "You mean the value of silver? I'd think he'd be happy if the value of gold went up."
Alice: "Oh, yeah, thanks. I meant silver."
What do you mean by "____"
is also an understandable sentence: it is asking the speaker for clarification on something they just said.
Alice: "I believe that it should be illegal to publish fake news."
Bob: "What do you mean by 'fake news'?"
Alice: "I mean anything that contradicts what I believe."
If you comment with what those last two sections were trying to say, I can try to correct them.