Throughout their lives, you have lots of conversations with them, many of which start with "What would you do if....."
Depends on age and maturity, it's an evolving understanding about who / when / for what reason you make a stand about something or challenge something or point blank refuse to do something, and when it's not ok, and how you can challenge some things in different ways (eg, not necessarily arguing back to a member of staff at school pulling you up on breaking a rule, but trying to get a daft rule changed by going to school council, or arranging an appt with head of behavioural support, or starting a petition or whatever might be appropriate.
You also support and encourage them to make decisions for themselves from when they are very young - might just be about wearing what they want. It might be they want to wear something other dc don't often wear, and you can talk about how it will make them stand out and that is their choice, and get them to think about their response if they get mocked or laughed at or criticised, but let them know they are string to make their own choices.
Encourage them to know it's fine to not like the particular music that is trending or watch a TV prog that everyone else is talking about, or of course similarly, to like something that is not fashionable.
All these things as a child help them have the confidence as they become a teen to say no to stuff they don't want to do and not give in to peer pressure.
Another thing is to make them go and talk to adults they don't know when they are little..... the cashier in the shop, the librarian, the receptionist at the leisure centre, etc.,etc. - ask their own questions, ask for help, have conversations with adults they don't know on a regular basis rather than jumping in and doing it all for them