Atomic number of nitrogen is 7. What can be inferred from this?
Nitrogen will share 3 electrons to form a diatomic molecule.
Nitrogen has 5 electrons at its outer-most orbit. Thus it will share 3 electrons with another nitrogen atom out of the 5 outer-most electron to attain octet configuration. Thus, both nitrogen atom will share 3 electrons with each other, so total electrons shared are 6.
Since thus total count of electrons in the outer-most orbit = 6 (Shared electrons) + 2 (Unshared electrons)
Thus nitrogen attains octet configuration, on sharing 3 electrons.
Since one bond is formed by 2 shared electrons, 6 shared electrons form 3 bonds.