When auxiliary verbs or modals participate in subject auxiliary inversion(of course, all forms of 'to be' and 'to have' where they are principal as well)they can be negated by simple addition of 'not'after them.
N't is contraction of "NOT". Negation of auxiliary verbs ending in 'n't' can participate in inversion as a unit.
So when contracted, as Wikipedia exemplifies,
—* Why have you not done it? becomes,
and goes thus far as to regard these negated-contacted-auxilaries as self sufficient UNIT of auxiliary verbs by their own right.
As an alternative, it says not to use the contraction, in which case only the verb inverts with the subject while the "NOT" is placed after it.
- Isn't this great> is this not great?
Note the form with *"Isn't it" no longer a simple contraction of the fuller form (which must be "is he not", and not * is not he.) Similar is the case of almost all other auxiliaries or modals.
When it is not inversion, N't form is colloquial or in speech.
In the other example with WHAT (acting as relative/interrogative pronoun) the subject is this pronoun itself. Here "n't" has its spoken usage, nothing more.
In our school days, we were taught not to invert NOT if the subject is a pronoun and to invert if a noun — veracity of which still eludes my understanding.