There is a diaphrgm in the valve. When the valve is closed the pressure on both sides of the diaphragm are equal. When you flush the toilet, a port, the pilot, on the chamber above the diaphragm opens and the incoming water pressure pushes it up so water can flow. When the float senses the tank is full, the pilot opening closes, and a bypass port, usually in the diaphragm, allows the water to enter the upper chamber and shut off the valve. The advantage of a pilot operated valve is that it opens and closes quickly. Especially compared to the common float valve which allows less and less water to flow as the valve is closing. The key to its proper operation is that there must be enough "residual pressure" in the valve, even with water flowing, to fill the upper chamber. It there is not, then the valve will flow "forever" or until there is enough pressure to close it.