Railway is an important and sustainable transportation mode, which despite good potentials results in a limited attractiveness, mostly due to the perceived consequences of unreliability. In fact, busy railway networks with frequent and heterogeneous services are highly sensitive to delay propagation, due to conflicts along lines and at stations. Primary delays due to accidents or failures spread easily in the network as consecutive delays, affecting passengers. Buffer times are able to reduce impact of delays, but dispatching actions are required in real-time to solve infeasible train traffic situations and limit delay propagation. Dispatchers currently limit their actions to strongly disturbed situations, and determine their decision combining their experience with the limited available information on the traffic status, often with suboptimal outcomes. Much better performance could be achieved if proactive and informed decisions were taken, based on detailed traffic information, extended for a period of traffic prediction, and based on advanced mathematical methods to deliver locally and globally optimal dispatching actions. This thesis investigates real-time railway traffic management, i.e. optimizing train orders, routes, departure times in real-time based on the actual, unpredictable situation of train traffic. Support to dispatchers is most required for difficult problems due to geographical size, traffic frequency and density, amount of traffic, operational policies adopted. A flexible and detailed mathematical formulation based on alternative graphs models precisely railway operations at the level of block sections to microscopically check feasibility of train movements along open track and in complex and busy interlocking areas according to the blocking time theory. Evolution of train traffic is simulated precisely based on the current situation of train positions, speeds, traffic and infrastructure status, and considering operational constraints due e.g. to crew or rolling stock plans, transfer connections. A variety of powerful advanced algorithms compute retiming, reordering and rerouting actions to solve potential conflicts and optimally minimize delay propagation, considering the available capacity at stations and lines in microscopic detail. Very large areas are decomposed in smaller, local dispatching problems that are solved independently, while an intelligent coordination procedure harmonizes their solutions and guides the solvers toward locally feasible and globally optimal solutions. The model is also able to take into account interesting objectives and requirements from stakeholders, such as energy-efficient operations, feasible emergency timetables for exceptional situations and heavily disrupted operations, online management of passenger connections. The investigation on comprehensive mathematical models, algorithms and approaches resulted in a laboratory dispatching decision support system, able to optimize and report a quantitative evaluation of advanced dispatching solutions of proven feasibility. Through real-time railway traffic management, better and more attractive railway services can be delivered to passengers with benefits for the whole society.