The central shaft in the cup contains a tube that functions as a siphon. An opening low in the cup leads to a (usually hidden) tube that rises to the top of the shaft and then curves down again to exit at the base of the cup. When the fluid level in the cup rises higher than the upper curve of the tube, it can act as a siphon and drain out all of the liquid. Similar mechanics are used in some household appliances to cause them to drain when liquid reaches a maximum level.
Despite the name, it is unclear whether the mathematician Pythagoras of Samos actually invented this device; but the earliest examples are believed to date to approximately that era (the 6th century BCE).