The board of directors (BOD) is responsible for deciding how it will share the company's earnings with shareholders in the form of dividends. In most cases, dividends are issued in accordance to a set policy and are paid on preset schedule, such as annually or quarterly.
The BOD is cutting a melon when the company has earned additional income, this is the melon and distributes a portion of it to shareholders. The bigger the melon, the sweeter it tastes to investors!