Atoms that typically form covalent bonds with each other have similar electronegativity, which expresses the atom's tendency to attract electrons, such as with carbon and hydrogen, which form methane. They stand in contrast to ionic bonds, where electronegativities are vastly different, as with sodium and chlorine, which combine to form table salt. These actually exist on a continuum with significant but lesser differences in electronegativity causing the formation of polar molecules.
Most bonds between atoms are at least somewhat covalent. Purely covalent bonds exist in molecules that contain only two or more atoms of the same element. Examples include oxygen, nitrogen, hydrogen and chlorine gases.
Molecules only really exist where the bonds between atoms have covalent character, which means that the electrons are at least partially shared by the member elements of the molecule. In fully ionic bonds, as in table salt, the bond between the ions is purely based on opposite charge, and each sodium ion in a pure salt crystal can be said to share an equivalent bond with each chloride ion surrounding it in its crystal lattice. If such an ionic compound were viewed as a molecule, it would actually be the size of the entire salt crystal.