Inversion puts the auxiliary before the subject.
Like a question
Normal: I have never seen such a mess.
Inverted: Never have I seen such a mess.
Three situations
After negative or limiting adverbials. After only. In conditionals: had / were / should.
Never I have seen such a mess. — no
Never have I seen such a mess. — yes