A quite simple principle is applied here: when you buy shares, you sort of invest in a company, allowing it to use your funds. The company uses this money and then thanks the investor by giving them a share of the profit — the dividends. It is curious that if you do not sell shares, but continue to keep them, your money remains in the business. For this reason, you can expect to receive dividends again in the future.
In theory everything works like that, but there are many nuances in the financial field just as there are in any other field. These nuances can be related, for example, to the global economic situation, company policy and so on. In some of these cases the principle of dividends may be different.