Human attention is an extremely scarce resource, and failing to design for that reality can have horrible consequences. From SkyNews:
A statement released by the court said Mr Amo [the driver of the train] had been talking on his work phone to an official of national rail company Renfe while apparently consulting a paper document at the time of the crash.
Rail operators are apparently aware of potential for disasters, as systems are being installed to engineer out the dependence on humans for braking in such situations. But sadly, such a program fell just three miles shy of where the accident occurred. From USA Today:
Authorities have said that a high-tech automatic braking program called the European Rail Traffic Management System was installed on most of the high-speed track leading from Madrid north to Santiago de Compostela… But the cutting-edge coverage stops 5 kilometers (3 miles) south of where the crash occurred, placing responsibility on the driver to reduce speed.