We use inversion to add emphasis or make something sound dramatic.
It is usually found in literary and formal texts, but we also use it in less formal spoken and written English for effect.
We often invert the subject and auxiliary verb when we begin a sentence with a limiting adverbial (eg. rarely) or a negative adverbial (eg.under no circumstances)
eg. Seldom do people realise how important a healthy diet is.
Under no circumstances are you allowed to smoke in this area.
When using inversion with Present Simple and Past Simple, the subject must agree with the auxiliary not the main verb
eg. Not only does it cost a fortune but it uses gallons of petrol.
With modal verbs (eg. will, should, could, etc) we invert the subject with the modal
eg. At no time should the customer feel unattended.
We can use inversion after another complete clause beginning with not until, only when, only if or only after
eg. Not until the dog becomes housetrained will I be able to relax!
Only when we got the scooter did we start discovering the city.
We use inversion after neither or nor when it introduces a negative clause related to one mentioned previously
eg. Consequently, David wasn’t accepted into medicine at the university, and neither was he accepted into physiotherapy.