Can I travel to both El Escorial and Segovia in one day? Can I do this by train or by bus or both? So at El Escorial can I make a train or bus connection that will take me to Segovia?
You cannot do this as a same-day roundtrip to Madrid, but you can do it if you want to sleep in Segovia. Then, there's the question of where to store your luggage in El Escorial; I have not confirmed whether either the train or bus station have official storage.
Both bus and train run frequently from Madrid to El Escorial but the bus drops you closer to the palace; bus time under 1 hour; see p. 496 if you have Rick Steves' Spain guidebook. You could continue by bus to the Valley of the Fallen (much closer than Segovia).
El Escorial and Segovia are not on the same train line (see map p. 495 or Google Maps), so train travel requires a connection and there are very few departures; there is one at 16:00 that gets to Segovia at 17:36, see Renfe or DeutscheBahn for train schedules.
I researched this for our 2005 trip and also concluded it was not feasible to do a day trip to both in one day. We asked a cab driver at El Escorial how much to Segovia and he said seventy Euros. We took the bus back to Madrid and did Segovia another day. With all the great day trips from Madrid, don't forget the city itself. I'd say it's worth three full days unless you have zero interest in art.