A tank connected to a pipe carrying a liquid and intended to neutralize sudden changes of pressure in the flow by filling when the pressure increases and emptying when it drops. There could be number of reasons for change in pressure.
Consider a pipe containing a flowing fluid. When a valve is either fully or partially closed at some point downstream, the fluid will continue to flow at the original velocity. In order to counteract the momentum of the fluid the pressure will rise significantly (pressure surge) just upstream of the control valve and in absence of any protective system, may result in damage to the pipe system. If a surge tank is connected to the pipeline just upstream of the valve, on valve closure the fluid instead of being stopped suddenly by the valve will flow upwards into the surge tank hence reducing the surge pressures experienced in the pipeline.
Upon closure of the valve, the fluid continues to flow, passing into the surge tank causing the water level in the tank to rise. The level in the tank will continue to rise until the additional head due to the height of fluid in the tank balances the surge pressure in the pipeline. At this point the flow in the tank and pipeline will reverse causing the level in the tank to drop. This oscillation in tank height and flow will continue for some time but its magnitude will dissipate due to the effects of friction.
Reverse would be the case if the valve is suddenly opened. In this case the sudden rise in fluid flow requirement due to valve opening is met by the fluid available in the surge tank, eliminating the possibility of pipe collapse due to negative pressure.