How do I find out the number of bonds an atom must link to?
It's named a covalent bond. The amount of hydrogen atoms that can be bond (or any other atom) can be  calculated most of the time using the octet rule, that states that any atom will try to get the electron configuration of a noble gas (i.e. 8 electrons in the outer shell). The electrons from the covalent bond count for both atoms that take part in the bonding.

As an example consider $\ce{N}$ that has five electrons in its outer shell, and $\ce{H}$ that has just one. $\ce{N}$ wants three more electrons and can get them from covalent bond with hydrogen. $\ce{H}$ want one more electron (this is an exception) in its outer shell to fill it up, so will kindly receive them from nitrogen.