As far as I know the line style infantry marching that was apparent during the Napoleonic era was still prominent during the civil war.
Wasnt artillery range and rapid fire weapons (6 shot pistols, Gatling gun etc.) improved by the time of the US Civil war? I guess to reword my question, why were line battles still prominent in the 1860's?
While there were a number of repeating carbines in production at the time, they were far too expensive for general issue and probably the drawn brass cartridges they required were also. The ones that did see action were either all or nearly all privately purchased. Sights were also primitive which would have severely affected accuracy at more than a few hundred metres.
Muzzle-loading MiniƩ-type rifles were the norm, firing at a maximum sustained rate of around 3 rounds a minute (or 1 rank of a 3-rank line firing roughly every 6-7 seconds), and early on a lot of units even had to use smooth bore weapons.
Attackers did face a disadvantage in these circumstances unlike the Napoleonic period, but not one so serious as to make successful attacks impossible. If one side wanted a battle, all it had to do was to march at something the enemy couldn't afford to easily let go and sooner or later there'd be a fight, and if there was a fight then linear tactics still provided the most concentrated fire power.
It was normal for maybe 1/10th-1/5th (depending on the commanders preference, terrain, weather etc.) of the men to be deployed in skirmish order 200-1000m and more ahead of the main line and specialist units of sharpshooters gradually evolved to fulfil this role. These men would fight prone and defensively their job was to stretch out the period of stress to which the attackers were subject prior to their assault. Attacking skirmishers were to drive back their enemy counterparts into the main line.
Rifled artillery performed disappointingly until they grew accustomed to employing it to greatest effect, and a lot of early-war artillery units were composed of smooth bore bronze cannon (which wouldn't fail abruptly like iron cannon sometimes would and had devastating close-range cannister fire power) exactly like those of a century earlier and barely changed from those a century older still.
Well this implies that trench warfare was some endemic issue in the first word war. It wasnt. It was unique to the Western Front from '15 to '16 which was more a strategic decision rather than a case of no other tactical option being available. In simpler terms the machine gun and 150 mm field gun didn't force trench warfare, strategic considerations did which were facilitated by terrain which favored defense.
Trench warfare was the exception not the rule even on the Western Front. By 1917 it was de facto abandoned and by 1918 mobile warfare took total dominance. Throughout the war, on the far larger theatsr, the Eastern front remained almost entirely untouched by the static nature of 1915-esque trench warfare. Same goes for everything in Africa and the Middle East.
Basically the issue I see here is an overly attached focus on the tactical level. Focus on the weaponry in particular. Weapons are important but they are not conscious actors. People are. And weapons don't necessarily force people into new tactical doctrines against their will.
With that said /u/Rittermeister is more qualified in this regard but trench warfare was used extensively in the later year or two of the ACW at places like Vicksburg. The armies used "Napoleonic tactics" (they were only in name) because of a heavy Jominian military theory influence at West Point along with mass conscript armies. The Union army shot from a couple thousand with the largest campaign ever conducted being by Scott commanding 12k to having well over a million men. With that came issues doing more sophisticated ideas in the tactical realm to put it shortly.