We have been taking a annual trip to Cancun with Virgin for the last few years. You don't have to do anything, just check in as normal and go through security. They leave a little card in your passport when you enter the country (make sure you don't loose it!) then at check in for your flight home they stamp it and attach it to your boarding pass. It then gets taken off the boarding pass at the gate.
I think most airlines (apart from Thomson perhaps?) now include the departure tax so not sure what those that don't make you do, presumably pay at check in or go to a desk somewhere, because it has always been included for us I have never asked or noticed!
As a tip it pays to walk fast off the plane as the immigration queue at Cancan can be insane if a couple of US flights or the BA 777 get in at the same time. We always go for seats in the bubble to ensure we are one of the first off. The departure gates are not really suitable for a 747 either and it turns into a massive scrum when they call for upper and premium with the whole of economy trying to get through. Best to get to the gate early and grab a seat near the door to avoid it!
Enjoy Cancun!