how does affiliate marketing work

How affiliate marketing works?