Sales are typically tracked with cookies. Each affiliate program is set up differently with a different cookie, which determines the time period that you are eligible to receive a commission from when a user clicks on a link.
If a user clicks on a link and the cookie period is 30 days, then if they make a purchase on that merchant's site within 30 days of clicking on your link (and they haven't clicked on any other affiliate links to get to that site, or entered the site via another marketing channel such as newsletter, search, etc.) then you will receive a commission for their purchase. If you do not receive a commission you can find various reasons why this may happen here.
We typically see a 30 day cookie life but they do vary according to the Merchant's terms.