Why must “has” come before the main verb here? [duplicate]
Because never is a negative, so you have the instance of obligatory subject–auxiliary inversion called negative inversion:
In linguistics, negative inversion is one of many types of subject–auxiliary inversion in English. A negation (e.g. not, no, never, nothing, etc.) or a word that implies negation (only, hardly, scarcely) or a phrase containing one of these words precedes the finite auxiliary verb necessitating that the subject and finite verb undergo inversion.
See the rest of both linked articles for more. If you have no auxiliary, you must provide one via do-support:
- Never again did I scratch my eye after cleaning jalapeños.
- Seldom do I invert my statements, except for when the rules require that one do so.
Inversion is also normal in questions, but you got that one wrong, too. You should have said:
Why is “has such a thing happened” the right form?
Because you need subject–verb inversion in a question. You also need more practice with capitalization and punctuation; otherwise you risk confusing people.
This is a case of inversion that appears after certain negative or restrictive expressions and "only".
Paraphrasing Swan:
Rarely had the sunset been more gorgeous.
Seldom could she see such a gorgeous sunset.
Never had she seen a more gorgeous sunset.
Hardly/*Scarcely* had she left the house when she saw the gorgeous sunset.
No sooner did she open the window that she saw the gorgeous sunset.
Only after looking out the window did she notice the gorgeous sunset.
In no way could she imagine how gorgeous the sunset might actually be.
At no time did she see a gorgeous sunset during her stay there.
Under no circumstances would she have said that the sunset was gorgeous.
On no account was she allowed to see the gorgeous sunset.
(*) Note that the last three examples are actually "negative" sentences in that she didn't see the sunset, didn't think the sunset was gorgeous, and wasn't allowed to see the sunset, while the other sentences have a "positive" meaning.