Self ionization is also called as autoprotolysis. It means that the same compound acts as a proton donor and proton acceptor. This is possible because of the lone pair of electron present on N atom and polarity of the bond in the molecule.
NH3+NH3⇌NH+4+NH2−
In the above reaction, NH3 is a proton donor as well as a proton acceptor.