Most efficient is to fly into/out of Madrid and Granada. Check price options to decide which. If nothing else fly round trip to Madrid but get a Vueling flight to or from Granada at one end or the other. It's not a bad idea to check Alhambra reservations, they may drive your itinerary.
Everything else is convenient by train Madrid to Cordoba (stay a night if you have it), Cordoba to Sevilla, Sevilla to Granada (or reverse depending on your flight plans).
If you want to do side trips, check the bus stations. Not only do they do cheap rides between towns but they run a lot of day trips. Everything that includes a bus is a good value and never needs reservations (I like to pick up tickets the evening before so I have can schedule the next day).