You might want to look at
https://scilearn.sydney.edu.au/fychemistry/prelab/e12.shtml
and the related page
https://scilearn.sydney.edu.au/fychemistry/calculators/lattice_energy.shtml
which has a nice lattice energy calculator that allows you to play with the parameters and see how the lattice energy varies, but I'll try to summarise those the argument below.
Here we are dealing with the ionic model - everything is totally ionic, there is total charge separation, all binding is electrostatic. Thus our system consists of a set of point charges. We can write the energy of such a system as
$$
E=N_AM \frac{z_1 z_2 e^2}{4 \pi \epsilon_0 r}
$$
where $N_A$ is the Avogardro constant, $z_1$ the charge on the first ion, $z_2$ the charge on the second, r is the closest separation of the ions and M the Madelung constant. Now note the Madelung constant only depends upon the structure of the crystal - all Sodium Chloride type crystals, whether it be NaCl, KF, or FeO, all use the same value off M. Looking at the formula we can see that FOR A GIVEN STRUCTURE (i.e. with the same M)
- High charges on the ions mean high lattice energy
- Small separation means high lattice energy
Thus point 2 addresses point 2 in your question, K is bigger than Li, hence the separation is bigger in KF than LiF, hence KF has a lower lattice energy than LiF. The first point explains why MgO has a higher lattice energy than NaF. However it doesn't cover your first example, as $\ce{AlF3}$ and MgO have different structures (and actually I don't think it is a very good question).
Comparing different structures is very difficult. About the best we can do is the electrostatic term from the Kapustinskii equation (https://en.wikipedia.org/wiki/Kapustinskii_equation)
$$
U_{L}={K}\cdot {\frac {\nu \cdot |z^{+}|\cdot |z^{-}|}{r^{+}+r^{-}}}
$$
This is an approximation to the above. Here K is a constant which is INDEPENDENT of structure and $\nu$ is the number of ions in the empirical formula, 2 for MgO, 4 for $\ce{AlF_3}$. Thus assuming ${r^{+}+r^{-}}$ is the same for both of these $\ce{AlF3}$ has a bigger lattice energy because $\nu\cdot |z^{+}|\cdot |z^{-}|$ is bigger - For $\ce{AlF3}$ it is 4*3*1=12, while for MgO it is 2*2*2=8. What this is really saying is that the $\ce{AlF3}$ structure has a much larger Madelung constant than the NaCl one, enough to overcome the charge differences, and thus it has a higher lattice energy.