The following rules apply to almost all written questions.
Auxiliary verb before subject
In a question the auxiliary verb normally comes before the subject.
Have you finished the project? (NOT You have finished the project?)
Who are you talking about? (NOT Who you are talking about?)
Why are you crying? (NOT Why you are crying?)
If there is no auxiliary verb, we use do, does or did before the subject to form the question.
Do you like classical music? (NOT Like you classical music?)
Did you like the movie? (NOT You liked the movie?)
Note that do is not used with other auxiliary verbs or with be.
Can you tell me the time? (NOT Do you can tell me the time?)
Have you gone there? (NOT Do you have gone there?)
Are you coming? (NOT Do you are coming?)
Infinitive without to
After do, we use the first form of the verb. Also note that infinitives are used without to.
What does he want? (NOT What does he wants?)
Did you go there? (NOT Did you went there?)
Only the auxiliary verb goes before the subject
Note that only the auxiliary verb goes before the subject in a question. We do not put the whole verb before the subject.
Are you going to invite John? (NOT Are going you to invite John?)
When the words who, what or whose is the subject, the question word comes before the verb. Note that we do not normally use do in questions that have a question word as their subject.
Who let the cat in? (NOT Who did let the cat in?)
What happened? (NOT What did happen?)
How many people attended the meeting? (NOT How many people did attend the meeting?)
Do, however, can be used for the sake of emphasis.
So who did the heiress marry in the end?
Do is also used when the question word is the object.
Who do you want to meet?