There is no one right or wrong way to climb a hill. If you get to the top, you've succeeded.

Climbing out of the saddle will work different muscles. That can be beneficial if your other muscles need a break. It can also be effective when you need a short burst of power or speed Sometimes, if you've otherwise run out of gears and the climb steepens, you may have no choice but to get out of the saddle. I often get out of my saddle on short climbs because it's kind of fun to power up something like that.

Some people--and a lot of women from what I've gathered from past threads--really prefer to do seated climbs. That's perfectly fine. Past discussions on TE suggest that some bikes have better geometry for out of the saddle climbing. Regardless of what you prefer, I think it's good to get comfortable with both if your body and bike allow. It's just another tool to have in your tool chest for tackling whatever the road throws your way.