How to Include Santiago on Your Spain Itinerary
Santiago is 470 miles from Madrid. That's as far as Barcelona or the southern tip of Andalusia. And as the high-speed AVE train doesn't yet reach Santiago, journey times are longer than to pretty much anywhere else in Spain. If you have no interest in visiting anywhere else between Madrid and Santiago, your best option is to fly.
But if you want to avoid planes, you're going to want to break up your journey. However, as the crow flies, there aren't really any major sights, with only Leon and its fantastic tapas scene really worth stopping for. And even then, you'll only want to make the trip if you're driving, as trains are painfully slow between Leon and Santiago and buses are not much better.
Instead, your best bet is to extend your itinerary somewhat and either head west into Portugal and then north, or north to the Basque Country and then west. However, this adds considerable travel time to your journey, so only do this if there are sights you are interested in along these routes.
Train and Bus
The train from Santiago de Compostela to Madrid takes about seven hours and costs under 50 euros, with beds from about 80 euros. There is also a night train.
There are regular buses throughout the day between Madrid and Santiago de Compostela. The journey takes eight hours and costs more than the train! There are cheaper buses, but these take even longer.
Trains from Madrid to Santiago de Compostela depart from Chamartin train station. Buses from Madrid to Santiago de Compostela depart from Mendez Alvaro bus station.
Driving this 470 miles journey takes about six hours, traveling mainly on the AP-6, A-6, AG-53, and AP-53 highways. Note that AP roads in Spain are toll roads.
Consider a stop in Salamanca or Leon to break up the long journey.