Arrangements between railroads

Railway companies can interact with and control others in many ways. These relationships can be complicated by bankruptcies.
Operating.
Often, when a railroad first opens, it is only a short spur of a main line. The owner of the spur line may contract with the owner of the main line for operation of the contractee's trains, either as a separate line or as a branch with through service. This agreement may continue as the former railroad expands, or may be temporary until the line is completed.
If the operating company goes bankrupt, the contract ends and the operated company must operate itself.
Leasing.
A major railroad may lease a connecting line from another company, usually the latter company's full system. A typical lease results in the former railroad (the lessee) paying the latter company (the lessor) a certain yearly rate, based on maintenance, profit, or overhead, in order to have full control of the lessor's lines, including operation.
If the lessee goes bankrupt, the lessor is released from the lease.
Stock ownership.
Most railroad companies are publicly traded with stocks. As the stockholders control the company, one railroad company can buy a majority of stock of another one in order to control it. Sometimes a bridge line, a railroad that has a majority of traffic coming from points not on its line, is owned equally by the companies that use it (via trackage rights).
Stock ownership does not automatically cause a merger of operations, merely in friendly policies towards each other. Operating and leasing agreements typically require a more stringent approval process through the regulating body.
If the owned company goes bankrupt, its stock is worthless, and the owner no longer controls it (unless it buys it back at auction).
Consolidation.
Consolidation happens when two railroad companies are consolidated. It is often the last step in an arrangement between two railroads, and is hard to undo, except in the case of bankruptcy, when different parts of the railroad may be sold to different buyers at auction.
Trackage rights.
Trackage rights (US), running rights, or running powers (UK) are an agreement between railroad companies in which the owner of tracks grants another railroad company some use of them. The deals can be long-term or short-term, do not always include the right to serve customers on the line, and may or may not be exclusive.
Short-term agreements are typically made when some kind of disaster affects one railroad and a parallel railroad line is fully operational or to allow the railroad to perform maintenance on the line. The parallel railroad will often grant temporary rights to the affected railroad until the problem is resolved. Long-term agreements can be made to allow competing railroads access to potentially-profitable shippers or to act as a bridge route between otherwise disconnected sections of another railroad.
A deal in which the owner grants only the right to run trains, not to stop for passengers or freight, is called overhead or incidental trackage rights.
A union station or terminal railroad typically involves trackage rights. The company that owns the station and associated trackage is typically owned in part by the railroads that use it, which operate over it by trackage rights.
In some rights deals, the owner of the tracks runs no trains of its own. That kind of arrangement can be done also by a partial lease.
In the United States, all trackage rights agreements are filed with the Surface Transportation Board and are available as a matter of public record.
Examples around the world include:
Haulage agreement.
A haulage agreement is similar to one of trackage rights, but the railroad that owns the line operates the power for the cars of the latter company.
Mine Gate.
BC Iron is a small iron ore mining company which uses the railway of the larger Fortescue Metals Group to move its ore to port. The two companies have created a "mine gate" joint venture in which Fortescue will take BC's iron by rail to port in exchange for 50% of the deposit.
History.
Originally, at least in the United States, it was not clear whether railroads were going to be run like turnpikes, in which any paying customer could use the road. The Seekonk Branch Railroad in East Providence, Rhode Island (then part of Seekonk, Massachusetts) tested this by in 1836 building a short branch of the Boston and Providence Railroad to their own dock and using the full line of the B&P. Massachusetts passed a law prohibiting this, and the B&P bought the branch in 1839.
United Kingdom.
Earliest railways.
The Swansea and Mumbles Railway, the world's first passenger railway service operated in the same manner as turnpike roads. When it opened in 1807 anyone with a suitable horse-drawn waggon could use the line in exchange for paying a toll. The railway operated in this manner until passenger services ceased in 1826 or 1827 due to the construction of a turnpike road parallel to the railway.
The Stockton and Darlington Railway of 1825 opened with mostly horse-drawn trains, with anyone able to operate their own trains on a turnpike basis.
The Liverpool and Manchester Railway of 1830 opened with purely steam locomotive haulage, and the need for greater co-ordination meant that the railway had to operate the trains. Private wagons hauled by company trains were tolerated. This set the pattern for the next century or more.
Canals.
Canals were and still are operated like turnpikes, where the canal company was prohibited for anti-monopoly reasons, from operating boats on the canal.
British Rail.
After 1948 the majority of the United Kingdom railway network was nationalized as British Rail for both political and practical reasons. Internal industrial operations and some minor lines were excluded from the process. Where industrial lines met the railway network proper trains would be transferred from the industrial operator to British Rail control with non-British Rail locomotives and engineers never being permitted onto the British Rail network. Arrangements existed whereby non-British Rail operators could own rolling stock. This changed in 1986 when, in a very different political climate Foster Yeoman were able to obtain the right to run their own trains onto the British Rail network providing British Rail locomotive engineers were used.
In 1997 the British Railways network was privatized as a single company Railtrack, and after this became a non-profit company Network Rail. Multiple companies hold rights to operate trains on the national network either as for-profit operators or government aided passenger franchises. A formal safety process exists for gaining access along with driver and equipment requirements as well as a pricing scheme. Any organisation meeting all these requirements can become a railway operator and access the national network.
As well as holding access rights to the national network (and in some cases internationally via the Channel Tunnel) many of the freight operators have agreements permitted them to access private networks operated by industries and ports, and in some cases also onto heritage railways, several of which now also carry small amounts of commercial freight traffic.
Passenger operators also have agreements with some of the heritage railways allow them to run special trains to connect with heritage railway events. Similarly heritage railway operators and railtour operators have reached arrangements to access the national network and run heritage trains, often steam powered, to and from the national rail network. As of 2007 this has extended to regular summer timetabled services on both the Stratford Upon Avon line in the Midlands and from Grosmont, North Yorkshire on the North Yorkshire Moors Railway to Whitby on the national rail network.