How does MySQL determine the 'index first key' and 'index last key' with indexes?
That is really the job of the MySQL Query Optimiser.  You can determine more information by evaluating the results of EXPLAIN.

You can also manually tweak the Query Optimiser by forcing or hinting an index, or changing the optimizer_search_depth variable which will tell the Query Optimiser how far in the future of each incomplete plan the optimizer should look to evaluate whether it should be expanded.