Why do some covalent compounds form lattice while others do not?
See, as far as I know, their is no fixed way to compare catenation properties of elements randomly without any context. Some general pointers however, to keep in mind are-:
Carbon has one of the highest catenation powers, as soap molecules like sodium stearate can contain up to 17 carbon atoms.
After carbon, some other elements having significant catenation tendencies are silicon, sulphur, boron etc. (roughly in that order). I will not be elaborating further here as I'm not very sure myself about this except perhaps a few rough pointers such as medium-ish size of atom and the presence of group 13 and 14(which have the maximum number of covalent sigma bonds formed without expansion of octet)
The thing you really need to understand is that the ability to form multiple bonds is more important here to predict the bonding nature of the crystal lattice. Oxygen and nitrogen can form multiple bonds, which would allow them to kind form cross links while satisfying the valency of the central atom. While on the other hand, fluorine will finish it's covalency in satisfying the needs of the central atom (Si) only, so the tetrahedral unit formed will majorly interact via Van der Waals forces (checking it with the facts, this is a pretty good prediction). The exact crystal structure of SiO2 and ALN are quartz and wurtzite respectively, which would be difficult to predict simply by making the covalent structures. However, a fair idea can be taken about the kind of interactions which will prevail in the crystal lattice, provided it is also covalent.