While it might be tempting, avoid hitting or "violently shaking" your head when you have water stuck in your ear. "This will not effectively get the water out and may cause dizziness or inner ear ...
An infection may be the result of swimmer's ear, in which water becomes stuck in the ear and will require medical treatment.
When we use cotton buds, what we actually end up doing is pushing earwax deeper into the ear where it gets stuck in the parts ... to push a pressurised flow of water into the ear canal to dislodge ...