Plenty of resources on this. “The Great Iron Trail, The Story of the First Transcontinental Railroad” by Robert West Howard is the book I read 40 years ago. If you want a full history, not just a Wiki summary, find a book on the topic.
But even the Wikipedia summary adequately addresses the story.