RPM is calculated by dividing the total revenue earned by publishers by the number of impressions their ads receive, and then multiplying by 1000 to get the rate per thousand impressions. It is essential for publishers as it provides insights into the rate at which they are making money and helps them identify the most valuable pages and sessions on their website.