Someone else will probably come along with a better cited and more comprehensive answer than this, but Railway guns were a very successful attempt at deploying super-heavy artillery on the battlefield. Mostly they later day siege guns like the 270-305mm Coastal Defense Mortars and Howitzers that saw use, or more conventional larger naval guns of varying levels of obsolescence. They were used on the general logic that quite often, the ability to fire a bunch of half ton shells at something is worth the effort and expense as the most modern battleships and fortresses would have difficulty surviving such a bombardment, never mind comparatively fragile field works.
Particularly large pieces that couldn't mount their own fully capable traverse and recoil systems (like the WWI era American 14"/50, or most of the cross channel guns, and the massive 80cm Schwerer Gustav deployed against the Fortifications around Sevastipol in WWII) would simply be placed on a section of track hastily and specifically built for the gun, and then moved around that track to traverse (aim more or less) the gun. Smaller pieces (usually equivalent to the secondary armament off battleships, or the primary guns off cruisers,) including the railway mortars and howitzers would have enough traverse that they could just be brought up on a spur, and didn't require nearly as much work.
What finally killed Superheavy Artillery as a concept, was that like Coastal Artillery, it became effectively obsolete because of tactical and technological advancements. Improved battlefield rocketry and better aerial bombing technologies allowed for essentially the same amount of firepower to be deployed faster and more easily against fortifications as the battlefield once again became a more dynamic place than it had been in the first world war. Even then, close relatives like the M65 Atomic Cannon, 2A1 Oka and 2A3 Kondensator 2P on motorized carriages instead of railcars hung around into the sixties as rocket and missile systems capable of delivering nuclear weapons developed.
Poking around on Wikipedia would probably help get the general gist more.
Artillery in the Great War - Sanders Marble & Paul Strong (Pen and Sword Military, 2011) ISBN-13 978-1844159499
42CM “BIG BERTHA” AND GERMAN SIEGE ARTILLERY OF WORLD WAR I - M. ROMANYCH & M. RUPP (Osprey, 2013) ISBN: 978 1 78096 019 7
Artillery: An Illustrated History of Its Impact (Weapons and Warfare) - Jeff Kinard (ABC-CLIO, 2007) ISBN-13: 978-1-85109-556-8
Railway Artillery: A Report on the Characteristics, Scope of Utility, Etc., of Railway Artillery. (Vol.I and II) Ordinance Department Document No.2034 1921-1922