MySQL uses indexes to optimize queries and improve performance. Indexes are stored in b-trees to keep data sorted and allow fast searches, inserts and deletions. The selectivity of an index, or the ratio of unique values within a column, determines how effectively the index can reduce the result set size. Highly selective columns on frequently queried subsets of rows make the best candidates for indexes. MySQL can use indexes to optimize data lookups, sorting, avoiding full table scans, and certain aggregation functions.