Yes dogs do get ear infections. Some of them are related more to bacteria and some are yeast.
He is holding his head at a angle and shaking it because of fluid and discomfort. If he continues to shake his head too vigorously he could cause a hematoma to develop on the outside of his ear.
When there is blood that is being seen it could mean that the area has become so irritated and/or he has scratched it enough to cause bleeding. Without being able to see down in the ear I would not recommend that you put anything down in the ear.
He needs to be examined by your veterinarian asap or you can take him to an emergency hospital, but in the meantime you can use dilute white vinegar (50:50) on a tissue to wipe the inside of his ear. DO NOT pour the solution into his ear because if this problem has progressed to an inner ear (beyond the eardrum) problem you can cause further complications
Ear infections can sometimes be ongoing problems and in that cause are either because of a deep seated infection that was never completely treated or it begins as a yeast infection (sometimes related to allergies) which then has secondary bacterial complications.
The quicker you resolve the issue the better your pet will feel.