Firstly, thank you for your question. So, to start, the objective of dribbling is to find a gap so that you can beat the player. These have various methods such as making the player off-balance, looking for a nutmeg between the legs, reading and anticipating where the defender would opt to tackle the ball.
Second, this is also depends on your situation and also your team's situation. For example, you could dribble to buy some time for your team-mates to support you on the counter-attack.
Finally, your decision also comes through practicing dribbling skills and also match experiences as each match has different situations.
Hope that helps and all the best !