You start with what you are given (in example 1 it was km) and find a unit you know is equal to a number of the unit you start with(she knew that 3280 feet were in a km) So, you multiply what you are given (x km/1) by 3280ft/1km. Since these are equal, it's the same as multiplying by one, you're not changing the value, just the unit or way it's measured (ft rather than km). Then, once the km cancel out ( you have one on top and one on bottom) you find the next unit you know (she knew that 1 mi=5280 feet) and you multiply by that (1mi/5280ft). Then the ft cancel out (because they are on top and bottom) and the only unit left is miles. You multiply all of the numbers on top (x)(3280)(1) and that becomes your top number and multiply across the bottom (1)(5280). This Leaves you with 3280x/5280, you then work the fraction. Remember whatever number you start out with (the number before km) is the number you replace x with. Your end number is ___ miles, because this is the only unit you had left since we cancelled the rest out.
*Note: when you have two units that are equal ex) 3280ft=1 km, you can set it up with the km on top (1km/3280ft), or the ft(3280ft/1km). It doesnt matter, you just want to be able to cross cancel, so look at your fraction to the left and make sure that what you want to cancel is opposite its matching unit in the fraction on the right.
Hope that wasn't too confusing, saw that someone asked for a formula, and there's really not one, it will change for every problem. You just take what you are given to start with and multiply by units that are equal to each other and continue doing so until you get to the unit you want your answer in