One of the key things to establish early in a campaign is the table culture, and I've found that setting rules for your table (especially in any type of formal group) can help establish this. When thinking about what rules you want at a table, I've found they generally fit into two categories- generative and prohibitory, the former helps create a positive table culture, and the other identifies the boundaries. Given those guidelines, it becomes a lot clearer to your players what sort of game this is, and clearly states what is unacceptable behavior, and what rules to follow if they want to be part of this table.
Table rules are best discussed during session 0, so players all have a good understanding of what is acceptable and not, and can all hold each other accountable. If a player misses session 0, I give them the quick overview before, just to make sure everyone is on the same page. I've heard of some DMs creating player contracts, but I've never seen that as necessary for any of my groups. (Ironically, my groups are some of the most paperwork heavy groups I'm aware of, but that's due to my propensity for bureaucracy dungeons.)
The following are some of the generative rules. These help establish what sort of table we want, and clearly outline what behavior we want to see at this table.
-Respect each other, as we are all part of the same team
-Raise your hand if you want to speak, and one at a time please
-Work towards consensus, I don't like having to split the party
-If you have a problem with a DM ruling, wait till after the game to discuss it
-If you find part of the game distressing, call a time out, and we can skip over it
-You can step away from the table at any time for any reason, but let me know where you will be and when you'll be back
-Please respect each others boundaries, noise sensitivity, and feelings
The more prohibitive rules are more about setting boundaries about what I absolutely do not want at my table. These I tend to be a lot more proactive about managing, as going lax on them can cause the players to lose respect of the rules, and that can be hard to regain.
-No real world political talk at the table.
-Absolutely no racial, homophobic, or otherwise bigoted slurs. If someone tells you something is offensive, do not argue with them, instead listen to them and stop your behavior. If you have questions about something, we can discuss this later.
-Do not become aggressive- i/e intentionally insulting others, hitting others, or screaming at others aggressively. This will result in a table ban.
-No phones at the table (Even with online D&D components, I have always found them distracting, and the online D&D components have generally been *less* efficient than pencil and paper as things take a longer time to load, you have to fiddle with a smartphone, etc.)
-No evil alignments.
-Don't split the party
-The content level is (insert the content level here, usually I set it at PG for my teen groups, PG-13 for my adult groups.)
This is just a handful of rules I have for my games, but this is in no way a solid list- I change things up based on the group I'm working with and their needs, and ultimately, having these goals and boundaries helps set the players up for success in the game and with each other.