Within the affiliate account of every signed up user, they have a referral link. If this link is shared and anyone signs up as a result from it, this is going to be noted in the database and the user gained a referral.
Once a user has referrals and they start uploading media, depending on whether you set a percentage in your admin panel, the user can earn revenue off of the referral.