Like norstern said, line of sight is not really an issue with pretty much any big ordinance in the modern battlefield. If a hypothetical railgun-ship wants to engage a target, there are multiple sources of information to derive a target's location: sonar, GPS for stationary targets, AWACS, forward scouts, advanced radar techniques such as bouncing them off of the ionosphere.
Anyways, why railguns over aircraft carriers/missiles etc? IMO railguns will never replace either of these, but fill in its own niche. In the next 25 years the US Navy is expecting to be able to fire off a 10 round salvo in less than a minute, with an accuracy of 5 meters at over 200 NM, with a damage potential greater than a tomahawk (the solid railgun projectiles travel so fast that they carry more energy than a similar sized projectile filled with explosives), and a *much* lower cost per round. Sure, a tomahawk has a range of over 1300 NM, but it takes almost 3 hours to get to its target (you are essentially sending a 1.45 million dollar uav to go kamikaze a building), while a railgun projectile takes only minutes. Essentially, if the enemy is competent, it can easily detect a tomahawk launch, and have plenty of time to put up counter measures, scramble fighters to take it down, or just pack up and hide what ever valuables in a bunker. On the other hand, railguns can send very accurate fire at a distance and there isn't much that can be done to stop the projectiles.
And these are just "next 25-50 year" predictions. The science behind railguns is extremely simple; the main hurdles right now are the fact that the projectiles pretty much destroy their rails after one shot due to the insane frictional heat generated. Once that is overcome, rail guns could become insanely OP. As long as you can keep the rails charged, you could literally shove a chain of projectiles into it and it will fire them off as fast as it receives them. Given that the guns are planned to be installed on nuclear-powered ships, the energy problem should not be that big of a deal.
As for the railgun-battleship resurgence, I do have to take that back a bit. Dreadnought Battleships were characterized as heavily armored (up to 11 inches thick in the belt area), carrying a bunch of big guns, and being the center of a naval fleet with the intent of duking it out with other battleships (although that rarely happened). If/when railgun technology does become viable it will be placed on a nuclear-powered ship, but I doubt it will be given any more armor than any other ship in the navy, nor will it be the 'center' of a naval fleet, but instead serve as a short-medium range stationary target strike capability. Sure it could also hit other ships, but I doubt any modern navy would allow its main battle groups to get within 500 NM of each other. I think the aircraft carrier will still dominate its role as the core of a naval battlegroup, but a modern railgun ship does have its uses.
also, bring on the infractions \o/