How did the warring nations end or terminate their trench lines when they ran into the ocean, an international border (like Switzerland) or into the mountains? We see many pictures of the actual trench lines but how did they end and stop the enemy from getting around them?
Here are some photos and info that might be what you're looking for.
The Western Front trench system ended at "Kilometer Zero" on the the Swiss border, with the trenches literally running up to a barbed wire border and a Swiss bunker overlooking them to ensure that Swiss neutrality was not violated.
The other end of the trench system literally ran out to the sand on the beach in Belgium near Nieuport. In contrast to the Swiss end, this terminus of the front saw more activity and fighting, mostly because of British plans for an amphibious outflanking maneuver (this never came to fruition) and German counter-maneuvers.