When only after, only if, only in this way etc. are placed at the beginning of the sentence for rhetorical effect, the subject and auxiliary are inverted:
In this type of inversion, the subject and the auxiliary switch positions. In the present and past simple, the auxiliaries do/does and did come before the subject, which is followed by the bare infinitive. The word order is the same as in questions.
When adverbial or adjectival phrases starting with so are placed at the beginning of the sentence for emphatic effect, the subject and auxiliary are inverted:
Echo tags are used in reaction to an affirmative or negative statement. They are formed in the same way as question tags (with the inversion of the subject and auxiliary), but an affirmative statement is followed by an affirmative tag and a negative statement is followed by a negative tag:
Question tags are placed after declarative sentences and are usually used in spoken language to keep up the flow of conversation. Affirmative sentences are usually followed by negative tags and expect the answer yes:
Questions are formed from statements by inverting the subject and auxiliary. In the present and past simple, the auxiliaries do/does and did come before the subject, which is followed by the bare infinitive. Be as a main verb can also come before the subject: