Originally, shareholders could be literally anonymous and collect dividends by surrendering coupons attached to their share certificates. Dividends were therefore paid to whomever held the certificate. Share certificates could be transferred privately, and therefore the management of the company would not necessarily know who owned its shares.
Like bearer bonds, anonymous, illegal unregistered share ownership and dividend collection enabled money laundering, tax evasion, and concealed business transactions in general, so governments passed laws to audit the practice. Nowadays, shareholders of S.A.s are not anonymous, though shares can still be held by holding companies in order to obscure the beneficiary.