The first thing you need to do is visit the veterinarian to discover whether the ear infection is caused by bacteria, mites or yeast. If it is a mild bacterial ear infection, an astringent cleaner may be all that is needed to change the PH balance of the ear canal, inhibiting bacterial growth.
Severe bacterial ear infections will need topical, and possible oral, antibiotics. A culture may be needed to determine which bacteria are causing the problem so the proper antibiotic can be given. Once the medication is prescribed, follow the directions exactly and continue for the full course of treatment. Never save up medication and never medicate a dog yourself, even if it is a repeat problem. Over use of antibiotics can cause bacteria to become immune and can cause a secondary yeast infection.
Ear mites are easily treated, but the application must be timed specifically to kill both the mites and the hatching larvae. Follow the label instructions.
If your dog has floppy ears with an abundance of coat, talk to your groomer about possibly shaving the inside of the ear flap to promote air circulation.