It's complicated. Here's the basic rundown:

There are two types of plans offered a PPO and an HMO. PPOs usually have larger deductibles, larger premiums or both, so if your employer offers a PPO, it will usually come with a larger out-of-pocket cost for you.

Here's how each works in theory for non-emergency care:

HMO: You have a physician that is your "primary care provider." This physician must have a contract with the insurance company. Any non-emergency care must be mediated by this physician. e.g. you go to the physician and they will refer you to a dermatologist if you have skin problems. The insurance company will pay for any care that the primary care provider recommends, possibly with a nominal co-pay (e.g. $20 per visit) and possibly with a per-year deductible. If you go to any doctor without a referral for non-emergency care you must pay everything out-of-pocket.

PPO: You can go to any doctor for any reason. If you go to a doctor that has a contract ("in-network") with the insurance company, insurance pays some fraction of the cost (usually around 80% for non-routine things). There is a maximum per-year out-of-pocket cost for in-network care. If you go to a doctor without a contract with the insurance company ("out of network") they pay either a smaller fraction of the cost, or the fraction of what the in-network would have cost (so if it's $4000 out-of-network and $2000 with an in-network doctor, the insurance would pay say 60% of the $4000 or 80% of the $2000 leaving you with a $1600 or $2400 bill respectively)

All of the above is for routine care. There are two levels of "emergency" above that: "urgent care" and "emergency room". Urgent care is "it can wait hours, but not a week" emergency room is "it needs help immediately"

For urgent care, it's more-or-less like routine care, except that you don't need a referral with the HMO. Just like routine care, if the urgent-care facility you go to lacks a contract with the insurance company, you will have to pay for everything out-of-pocket.

For emergency-room (ER), usually in-network doesn't matter, but usually you must pay at least $100 out-of-pocket to visit as a "co-pay" (compared to $10-$20 for other visits). However, if a doctor sees you in the ER that is not employed by the ER, and they do not have a contract with your insurance, you pay the out-of-network rate for just their services (i.e. you are stuck with the entire bill for an HMO, and you pay a larger percentage of the cost with a PPO). That's how we got stuck with a $4k bill after taking my son to the ER with an HMO.

That's all the "in theory" cost.

In actuality there is a lot of fine-print in the contracts giving ways for insurance companies to deny claims for various reasons, and they will almost always refuse a large claim for some bogus reason (e.g. I got a $90k bill when my daughter cut her hand on some broken glass and needed 60 stitches because the insurance company coded it as an "elective surgery") there is usually something like a 6 month limit for challenging claims, so if you don't spend about 20 hours on the phone over the next few months, you can end up stuck with a bogus bill just because you didn't challenge it soon enough.

> Who are the people who is becoming profitable with this? Doctors? Companies? Are doctors allowed to open their own offices and have high prices? From the outisde everything seem so confusing!

It's confusing from the inside too. Doctors do open their own offices and usually have very high prices. However, the insurance companies negotiate a lower price, and if you do get stuck with a bill, you can usually negotiate a lower price yourself (Insurance companies usually pay 1/3 to 1/2 of the original billed price).

The insurance companies make money, but the cost they impose is far larger than the profits they make, because of all the inefficiencies and administrative staff. A medium sized doctors office will often have at least 1 full-time employee whose only responsibility is to work with the insurance company. People often delay or forgo care because they plain just don't know if the insurance company will pay for it.