Simple in round numbers: Medicare helps to pay 80% of most of your medication up to about $3K. Then you enter the donut hole. You must pay 100% of your medication for the next $3K. After that medicare picks up 100% of most medications.
The are exceptions to every Medicare (government) rule, so you can expect lots of exceptions depending on the medical condition. Dialysis, and some other long term problems have all types of exceptions.
Back to the donut. If you can, always get generic medications. You can also shop these medications for price. If a major chain or a small independent will sell you a medication for $4.00 but you only pay $2 billing medicare, your medicare account is being charged $10. If your doctor suggests a brand drug and your cost is $25 medicare is being charged $125.
When you reach the donut threashold (like $2,500 or so) you will be charge the full cost of the medication until you reach the other side of the hole.
The best plan is to shop prices.