Nitrogen is a diatomic molecule in the VA family on the periodic table. Nitrogen has five valence electrons, so it needs three more valence electrons to complete its octet. A nitrogen atom can fill its octet by sharing three electrons with another nitrogen atom, forming three covalent bonds, a so-called triple bond.
The diatomic molecule with a triple covalent bond is N2. Nitrogen has five atoms in its valence shell. In order for it to attain the octet structure, that is, to have eight electrons in its outermost shell, it has to donate three electrons, just like the other element it is reacting with in order to form a triple covalent bond.