You obtain your initial prescription from your doctor. It used to be that the doctor gave you this on paper, and you took it to a pharmacy to fill. Nowadays most doctors ask you what pharmacy you use and are able to transmit the prescription electronically to the pharmacy.
If this is expected to be an ongoing prescription, typically the doctor will authorize N refills. The pharmacy can fill those refills with no further interaction with the doctor.
Many even automate this. The pharmacy I use for most prescriptions send me a text message when I should be near running out, and I just have to text back "yes" to refill it.
When you are out of refills, the doctor has to authorize continuing the prescription. Most pharmacies will handle that for you. You ask the pharmacy for a refill, they tell you that none are left, and that they will contact your doctor on the next business day.
In older times that was usually by fax or even by making a voice call to the doctor's office, but nowadays I think it is mostly via some sort of computerized system.
It's not actually your doctor that has to authorize additional refills or reissue a new prescription. It is often a "physician's assistant" at your doctor's office that handles this, especially when it is just renewing an ongoing prescription. There are also some kinds of nurses that can processes refills (there are something like 20 different kinds of specialized nurses--I forget which ones can processes prescription refills).
From the patient's point of view, then, it looks like this:
1. You get a prescription for some ongoing condition from your doctor,
2. When you need a refill, you ask your pharmacy.
3. Every so often there is a day or two delay in filling a refill because the pharmacy has to get your doctor's office to renew the prescription.