Nitrogen has five valence electrons and in simple amines it is trivalent with two remaining electrons forming a lone pair. Through it, nitrogen can form an additional bond to hydrogen making it tetravalent and with a positive charge in ammonium salts. Many nitrogen compounds can thus be potentially basic but its degree depends on the configuration: the nitrogen atom in amides is not basic due to delocalization of the lone pair into a double bond and in pyrrole the lone pair is part of an aromatic sextet.
^ F. H. Allen, O. Kennard, D. G. Watson, L. Brammer, A. G. Orpen. Tables of bond Lengths determined by X-Ray and Neutron Diffraction. Part 1. Bond Lengths in Organic Compounds. J. Chem. Soc. Perkin Trans. II1987, S1-S19.