You need to mix the orbitals, populate them with the electrons and see if you have net bonding.
Eg: H + H two 1s orbitals mix to form sigma and sigma*. Two electrons total, both occupy the sigma orbital, two more electrons in bonding than antibonding orbitals, the compound is stable.
Eg: He + He; same mixing as above. Four electrons, two in the sigma, two in the sigma*. Since there are as many bonding electrons as as antibonding, there is no net bond. He2 is not possible.
Eg: He + H; same mixing as above. Three electrons, two in sigma, one in sigma*. One more electron in bonding than antibonding. He-H forms a very weak bond. Please note the diagram is for He2+ but the He-H is very similar
Eg: Li + H; Li has 1s + 2s, while H has 1s. This mix to form a sigma orbital from H1s+Li2s, a sigma* orbital and H1s-Li2s, and a non bonding orbital from Li1s (lower in energy than the sigma). Four total electrons. Nonbonding sigma is occupied, and then the sigma orbital is occupied. Net effect: Li-H forms a stable bond.
You might have noticed that the first three diagrams had identical structure, even if their energy levels were different. This is a property of quantum mechanical symmetry, and solving the problem only requires knowing a few diagram types and filling the electrons in. Consider the second row. The diagram is as :
You simply count the valence electrons and fill in the diagram. Then you subtract the number of bonding orbital electrons from antibonding, and if you have more, you will have a bond.
A couple of webpages are very good for further explanation:
Source of the diagrams: