Fifty years ago, Dr Beeching wielded his axe, believing the railways faced an inexorable decline. Now the industry is on the cusp of the biggest expansion since the Victorian era.