你要什么?What do you want?
你要什么呢? What would you like to have? (a bit softer in tone compared to the previous one)
你在做什么吗? Are you doing something?
你做什么了?What have you done? What did you do?
First, let's break down your question into three parts.
- The word 什么
- How do different particles such as 呢,了 function.
- How does 什么 work with 吗
1. 什么:what
你在做什么?What are you doing? (You-doing-what?)
你在吃什么?What are you eating? (You-eating-what?)
你叫什么名字?What is your name? (You-called-what-name?)
那是什么?What is that? (That-is-what?)
2. particles 呢 and 了
呢 has a few functions. One of them is to soften the tone of a question with a question word. In this sense, it does not add anything to the meaning of the questions.
你要什么?What do you want?
你要什么呢?What would you like to have?
It is also often used in a follow-up question. For example,
A: 主菜你要什么? (For entrée, what do you want ?)
B: 我要意大利面。 (I want spaghetti.)
A: 饮料你要什么呢?(For drink, what would you like to have?)
B: 我要咖啡。(I want coffee.)
了 indicates completion of an action. See these examples for how it changes the meaning of the sentences.
你做什么?What are you doing? What are you going to do?
你做什么了?What did you do? What have you done?
你去哪儿?Where are you going?
你去哪儿了?Where have you been?
3. 什么 and 吗
吗 typically changes a statement in to a question.
她在看书。She is reading. (She-reading-book.)
她在看书吗?Is She reading?(She-reading-book-ma?)
As you can see, with a 吗 in the end, a statement becomes a question.
However, when it works with a question word, such as 什么, the question word would be understood as an indefinite. Here, 什么 would means "something."
Let's see how 吗 works with 什么.
你在做什么?What are you doing? (You-doing-what?)
你在做什么吗?Are you doing something? (You-doing-something-ma?)
The whole thing remains a question, but the meaning of 什么 is changed into "something."
Hope that helps! :)