How do I know crystal structures from formula?
I'll just point out the direction in which you could look for an answer.

In general case, it should be almost impossible to determine the crystal structure by looking at the chemical composition of a substance.

You are, however, asked to explain why different fluorides adopt different structure types, which is a different task. Perhaps, you should take into account the difference (sorry) in the ionic radii of Mg and Ca. Some structures prefer "fat" cations, some - "lean" ones. Most of the time, it's just plain geometry combined with experimental observations. I know the explanation is primitive, and ions are not just some rigid spheres, but the "ionic radii" approach works in many cases.

For many crystal structures there are ranges of ionic radii ratios in which the particular structure is more or less stable. Some of these ratios are so important that they have proper names, such as Goldschmidt tolerance factor for perovskites. Returning to your example, this page lists the cation/anion radii ratios for fluorite (0.73 or above) and rutile (between 0.41 and 0.73). You can check these ratios against the dimensions of ions in magnesium and calcium fluorites.

For the reference - this Shannon table hosted by Imperial College London is an excellent source of the values of ionic radii in oxides and halides. Just one more thing: the reference ratios are likely to be designed to work with so-called Shannon Ionic Radii, not the less-common Shannon Crystal Radii.