Ear infection?

How does the dr test for ear infection?

What medicine do they give for it ?