Normally a doctor can diagnose a bacterial ear infection by looking at the eardrum. It will be bulging and have pus behind it. If the eardrum ruptures, the eardrum can't be seen because it's covered with pus. So the presence of the discharge makes the diagnosis.