Not an expert by any measure but here's how I ride. If it's a short hill and I want to maintain a certain speed and gear I'll get out of the saddle if I need to. I try to push my butt back and continue with as much of a circle motion as possible (I'm on a tandem and circles are easier on my captain ) I really love the feeling of power I get when I do this. But it seems to work best on rolling hills.
What I have read about hill climbing seems to say you use less energy if you stay in the saddle, so on long hills I tend to stay down and I still try to be further back on my saddle - that seems to engage the hamstrings more. I find the higher my cadence the better my knees feel - so if that means gearing down - we do.
Good luck and have fun!
Veronica