Affiliates work to introduce their visitors to the merchant’s brand. They might write a post about a new product or promotion on the merchant’s site, feature banner ads on their site that drive people to the merchant’s site, or offer visitors a special coupon code. If people come from that affiliate’s site and make a purchase, that affiliate gets paid.
The topic you choose must have enough depth that you can create a lot of content for it. This is important for building an authoritative site, for search engine optimization, and most importantly, for the end user. If you don't have enough content about a topic, you're not going to be taken very seriously as an authority on the topic and it's unlikely you can convince someone to make a purchase from you.
Affiliate marketing is also called "performance marketing", in reference to how sales employees are typically being compensated. Such employees are typically paid a commission for each sale they close, and sometimes are paid performance incentives for exceeding objectives. Affiliates are not employed by the advertiser whose products or services they promote, but the compensation models applied to affiliate marketing are very similar to the ones used for people in the advertisers' internal sales department.