By now, you've probably heard about Transcanada's (NYSE:TRP) Keystone XL pipeline. For even the most casual observer of the energy industry, this project has been the spark that has ignited poltical debates ranging from environmental hazards, emission of greenhouse gasses, and North American energy independence. In Tuesday's speech on climate change, President Barack Obama made a point to discuss the fate of the Keystone XL: "Allowing the Keystone XL pipeline to be built requires a finding [from the Department of State] that doing so will be in our nation's interest."

There are clear environmental concerns that several people have regarding the construction of this pipeline, but the story is so much more than that. To help better understand the entire story of the Keystone XL pipeline, we at the Fool want to give investors a better look at what the Keystone XL means for all parties involved. In this part, we'll take a look at what Canadian oil sands mean to railroad companies, and what approval or rejection of the pipeline could mean for these companies. 

I got 99 Problems, but a pipeline ain't one
Before railroads even consider the fate of Keystone XL, they all have their own kinds of problems they have to deal with if they want to move oil via rail to the Gulf Coast. The average cost to move a barrel of oil from Alberta to the Gulf coast via pipeline ranges from $7 to $11; that price jumps to $30 if it decides to go via rail. The only way for rail to be a competitive force in moving oil from Alberta to the Gulf coast is if the current price differential between Canadian heavy oil, and other heavy sources, were to stay above that $30 mark.

For railroads, though, there are three distinct advantages that could play into their hands. Railroads can provide more delivery options for crude oil. So, if the opportunity was there, railroads could transport heavy crude to refineries on the East and West Coast. This has been a common trend that has proven lucrative for producers in the Bakken region. Both Valero and Phillips 66 have signed rail contracts to ship crude from the Bakken to their coastal refineries. As long as the costs for rail shipments to these other markets can stay under foreign crude prices, then rail has a much better shot at delivering to these refiners. 

Second, pipelines can only carry so much oil, and that excess produced in Canada needs to be delivered somewhere. Provided that every proposed oil pipeline were to come online in the U.S., the combination of oil sands and Bakken production is expected to outpace pipeline capacity by 2022. If producers are desperate to keep the oil moving, they might need to rely on rail, even if it means taking a price cut to move it to market. 

Finally, oil sands bitumen doesn't need to be blended for shipment. In order for oil sands to flow freely in a pipe, it needs to be diluted with light compounds such as condensate. If the price for these light products becomes prohibitively expensive, then rail has a shot at competing against pipelines. At the same time, it would still need to be able to deliver to the Gulf Coast at a price less than what we can import for.Rail Ins Us

Source: wikicommons.org/kmusser

Who actually will be affected?
In terms of oil sand crossing the border via rail, only Canadian Pacific (NYSE:CP)Canadian National Railway (NYSE:CNI), and Burlington Northern Santa Fe, part of the Berkshire Hathaway holdings, have rail lines that would deliver oil sands to the Gulf. Of the three, only Canadian National has the network available to deliver all the way from Alberta to Louisiana. 

This companies are also the only game in town in case producers and refiners find it attractive to move oil sands to refineries on the West; but if there is any intention to move East, then other companies need to get involved. Currently, Burlington Northern has a dual line agreement with CSX (NASDAQ:CSX) to move crude from the Bakken to Albany, New York, where oil is then placed on barges, and is either shipped to refineries on the Atlantic shore or in the St. Lawrence seaway. 

If Keystone XL gets built
It's very possible that the added capacity would slightly increase the price for Canadian oil sands while taking a small sliver out of the premium for Venezuelan and Mexican crude. As the price differential between these two shrinks, it makes deliveries by rail more difficult.

Again, rail doesn't have to beat the pipeline; it has to beat prices on foreign sources. If it can deliver, then there's no reason that it can't share in the oil sands party.

If Keystone XL gets rejected, it more than likely creates a better opportunity for rail to compete. Lack of takeaway capacity could potentially hurt prices for Western Canadian Select, which would also help rail companies. If prices can stay within a range where that $30 premium to move via rail is still competitive against other heavy crude sources in the Gulf Coast, then rail certainly has a shot to make an impact.

What a Fool Believes
Rail is an interesting option for crude oil, and it certainly can act as an emergency release valve when production in a new oil play doesn't have the adequate takeaway capacity to support production. One thing that doesn't make producers happy, though, is the lower prices they have to take in order to make it competitive in the open market. If Canadian oil sands producers need to consistently keep a $30 discount to other foreign heavy crudes, it's going to be awfully hard to make a buck. Check back at Fool.com to learn what the Keystone XL pipeline means to our friendly northern neighbors.

Fool contributor Tyler Crowe has no position in any stocks mentioned. You can follow him at Fool.com under the handle TMFDirtyBird, on Google +, or on Twitter, @TylerCroweFool.

The Motley Fool recommends Berkshire Hathaway and Canadian National Railway. The Motley Fool owns shares of Berkshire Hathaway. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.