As far as comps go;
You sign up for a card,then present it to the dealer when you sit down and buy-in.
The pitboss will write up a slip of paper noting the time,your buy-in and the average of your first 3or 4 bets. Periodically he will come by and note your current bet on the slip.
After you finish,he'll enter this information,along with your estimated winnings or losses into the computer.
Thats how you earn comps.
Getting your comps is another story.It differs from casino to casino.In some places,comps earned from table games expire in a day or so,other store them just like slot points.
After you have been playing a few hours,you'll have enough comps to get a free meal.Depending on the size of your bet,it might be a buffet or perhaps a steak dinner(if you are betting $50 or so) You ask the pitboss and after checking the computer and making a fuss,he'll almost always give you a comp. If he says you haven't earned it,ask him straight out how much more you need to play to get it.
After you leave,your play is noted on the computer and depending on the casino,you may recieve offers from the marketing department to get you back.These will range from match play coupons to free rooms to invitations to private tourneys.
Many casinos give something when you first join their players club,be sure to
take advantage of whatever they offer,and many give presents on your birthdays and anniversarys.
The system is ripe for exploitation,but thats a whole other subject. Read Max Rubins "Comp City",the bible of comp counters,such as myself.