The Medicare brochure titled “Medicare & Other Health Benefits: Your Guide to Who Pays First” describes this in detail.
In summary, if you have Medicare and other health insurance (like from a group health plan, retiree coverage, or Medicaid), each type of coverage is called a “payer.” When there’s more than one payer, “coordination of benefits” rules decide who pays first. The “primary payer” pays what it owes on your bills first and then sends the rest to the “secondary payer” (supplemental payer) to pay. In some rare cases, there may also be a third payer.
If the insurance company doesn’t pay the claim (usually within 120 days), your doctor or other providers may bill Medicare. Medicare may make a conditional payment to pay the bill and then later recover any payments the primary payer should’ve made.