I have seen a mock up of a WW1 trench (at the Cloth Hall museum in Ypres I think) which showed the level of planning and engineering that went into the management of water in trenches, and more so in dugouts.
The basic system was an inverse wooden A frame, the bottom (or top of the A) on the floor of the trench. The arms of the A (or V) were used to hold back the revetment of the sides of the trench, allowing for the inevitable slump in wet soil. Planking was laid along the crossbar of the A so that water drained naturally below it and with any luck the planking was at least out of the water. The void at the bottom could also be used for laying drain pipes connected to pumps.
The big problem of course is that obviously water flows downhill, and a lot of effort was put into pumping systems to try and ensure as far as possible that the water pumped out of one trench didn't simply fill the next one. Dugouts were an even bigger problem and had all sorts of complex gravel filled sumps and soakaways to try and make them usable.
Lots of lessons to learn again I think.