First thing I'll say, is "it depends." Pay structures for DM's and Instructors vary widely. I'm not familiar enough with pay structures for boat captains to comment.
For a DM or Instructor typical pay structure goes someting like this:
An hourly rate of pay + tips, AND/OR
A commission on courses (flat percentage of course fee per student); AND/OR
A commission on guiding dives (flat per capita amount for each paying customer); AND/OR
A commission on retail gear sales.
Sometimes benefits, such as health insurance are available. In certain resort destinations, housing, round trip air travel, annual PADI dues, and professional liability insurance, and the BIG $$$ cost of a work permit may be covered.
For a specific example, one Caribbean based operator made this job offer for a PADI Instructor:
US$6.10/hour pay + tips (all tax free),
No commission on gear sales, courses taught, or guided dives,
80% of health insurance premium,
No air travel expenses,
No housing allowance,
PADI dues paid after 18 months service,
No professional liability assistance,
Work permit fully paid,
and match of my 5% (of wages + tips) contribution to a pension plan.
This works out to about US$12,000 + tips per year in my pocket to live on. Rent on a basic 1 bedroom apartment runs about $1,000 per month. You do the math.
So if 4 students each pay $300 for an open water class = $1200 total into the shop. Of that cost, about $200 covers the shops cost of books. About another $100 covers prorated depreciation of the rental gear. Course is taught by 1 instructor for classroom, and 2 for confined and open water, so staff wages come to something like $400. That leaves about $500 to cover basic overhead(shop rent + utilities), pool and facility maintenance, fuel for the boat, profit, etc... In the end, I'd guess that the shop realizes a pure profit of 25% ($300) in this example. Bigger classes are more cost efficient, smaller classes less so.