Nitrogen has atomic number 7; so, when neutral, it has 7 electrons . Those electrons are organized according to the Aufbau principle in an electronic configuration of 1s2 2s2 2p3. That means there are 5 electrons in the last electron shell. These are valence electrons, the only that matter for bonding. Since nitrogen has 5 valence electrons and stability is acquired when getting eight (according to the octet rule), the atom needs 3 more electrons in its valence shell. To get them it establishes three covalent bonds with three hydrogen atoms (each of which has one valence electron and needs one more to become stable). In each covalent bond, hydrogen provides one electron, nitrogen another one, and both provided electrons are shared by both atoms. So the nitrogen atom gets the 3 electrons hydrogen shares with it plus its own five (getting a total eight and thus becoming stable) and each of the three hydrogen gets the electron nitrogen shares with it plus its own (getting a total two and thus becoming stable).
There are three covalent bonds between hydrogen and nitrogen, but note nitrogen had 5 electrons of its own at the beginning: 3 are being shared with hydrogen atoms and the other two conform a lone pair which bonds to no other atom. Because electrons repel each other (all are negatively charged and same charges repel each other) each electron pair is in the direction that allows it to be most separated from other electrons. As to accomplish this, the 4 electron pairs (or electronic domains) of nitrogen (the lone pair plus the three binding pairs) get the conformation of a tetrahedron. Hence we say the domain geometry of ammonia (NH3) is tetrahedral. However, one of the aforesaid 4 pairs is lone and binds to no atom: so the molecule's geometry is not tetrahedral. Instead, it is trigonal pyramidal, that is, just like a tetrahedron but without one of its vertexes.