If you go into Paypal, click on Merchant Services, and look for Instant Payment Notification (or IPN) you can download a manual all about this.
How it works in brief... Someone makes a paypal payment from your site, paypal recieves the payment and calls a URL you specify on your server. Paypal passes the variables to your URL (ie script) and you can then add these details to a database, etc.