Word order differs between questions and subordinate clauses (i.e. sentences beginning like “the place where …”, “the time when …”, “the man who …”). While word order in questions usually poses few problems, mistakes in subordinate clauses are very common.
Clauses beginning with “why”, “where”, “when”, etc., are often misleading because they look like questions (for example “Has she told you when …” or “I don’t know why …”). The rule here is that word order in subordinate clauses is exactly the same as in ordinary (non-question) sentences, that is:
I don’t know why someone is doing something.
(notice that “does” and “is doing” comes after “someone”). For example:
The same would happen in a question:
But isn’t word order different in questions? Yes, but the question is “Do you know …?”. The part “why she did it” is a subordinate clause, no matter what comes before it. People tend to make mistakes especially after “who” and “what”:
The structure is slightly different if there is no subject in the subordinate clause, i.e. when we actually ask about the subject: