A pipe is constructed. One end of the pipe points up stream, to capture a flow of water. As the water enters the pipe, nozzles entrain bubbles in the water. The pipe then goes down. As the pressure increases, the air in the bubbles is compressed. The bubbles shrink. At the bottom, the pipe turns up a bit to a plenum. It then flows sideways. The compressed bubbles rize to the plenum and pop. The pipe then turns down, emptied of air bubbles. It conveys the spent water back up to the surface to discharge the water.
A small pipe from the plenum can be used to direct the compressed air to any use.
Reportedly, tuyaus were used in place of bellows to feed Roman iron-working forges. Often the same forges had hammers powered by water-works.