Draw

Imo stalemate is the best way to draw if you are losing, but if you win, there's no good way to draw.

The goal of chess is ti checkmate opponents king, not to draw.
Of course the goal is checkmate, but in a bad position, it is wise to stop playing for a win and be satisfied with a draw because it’s better than a loss.

Draws can come from insufficient material, a perpetual check, a perpetual attack, a stalemate and an agreement. The best way depends entirely on the position and how much time left. Basic king pawn endgame puzzles specifically for draws and stalemates are a great way to learn how to get better at them, along with understanding tempo, opposition and outflanking, which is crucial toward understanding stalemates. A single tempo can be the difference in a stalemate verse a loss/win. It also teaches you how to avoid them when your opponent is playing for it.
Draws can come from insufficient material, a perpetual check, a perpetual attack, a stalemate and an agreement. The best way depends entirely on the position and how much time left. Basic king pawn endgame puzzles specifically for draws and stalemates are a great way to learn how to get better at them, along with understanding tempo, opposition and outflanking, which is crucial toward understanding stalemates. A single tempo can be the difference in a stalemate verse a loss/win. It also teaches you how to avoid them when your opponent is playing for it.
Very good advice!

There is no general advice applicable for any “bad” positions. For example if you are in endgame piece down, you try to exchange all pawns. But if you are in middlegame rook down then is probably best advice to use all your remaining pieces to try to checkmate opponents king.

You are correct that you can’t make rules work for all scenarios since chess has a lot of nuances. If you’re down a piece in the endgame, but you have a passed pawn on the 7th rank, that can be worth more than a rook. If you have an endgame down material but your opponent has a bad bishop, his bishop can’t be active since it’s being blocked by his own pawns.
If you are down material in the middle game, but you have the opportunity to checkmate, piece sacrifices are worth it for positional gain. If you are down material and in a poor position with poor development, trying to fight for a checkmate is a losing battle and your goal should be trading down their most active pieces and hoping your pawn structure isn’t totally messed up too. Otherwise, at that point, you can just resign and move on. There is 1 million different examples to do 1 million different things and this is why it’s so important to know as much of them as you can, and there is a big part about learning draws. There are openings that are known to lead to extremely drawish positions that people play with the goal of a draw when they know their opponent is stronger. It’s not bad either, you have to know your limits. This might not matter nearly as much playing casual online, but these types of games are certainly much more important when you are playing OTB tournaments with things like norms on the line.