How many steps it will take to get one increase in friendship is a geometric random variable, with the caveat that you need to multiply the result by the number of steps it takes to trigger one trial.
The expected value (average) of a geometric random variable is simply 1/p where p is the chance of success on each trial. For example, flipping a coin in order to get heads has an expected value of 1/0.5 = 2. Per the above, if we have a 50% chance of getting +1 friendship every 128 steps, then our expected value is 1/0.5 * 128 = 256 steps. All very simple.
But we want to reach 255 friendship, not 1 friendship. Fortunately, an expected value for this is also very easy to calculate for geometric random variables: you just add the expected number of trials to the first success, plus the expected number of trials to the second success, etc. This simplifies to x/p, where x is how many successes you want and p is the chance of success on every trial.
The only complicating factor is that in most games, walking increases friendship at a different rates depending on the existing friendship. So we need to split our calculations, account for the different boosts, and add the results together. I won't repeat the mechanics of this that are documented on Bulbapedia, only list the calculations we're concerned about.
Of course, there is also per-generation variance in the number of steps per roll and the chance of success on each trial. The chance of success on each trial is missing on Bulbapedia for Gen 6 and 7; I'm just going to assume it's 50%. Take those calculations with my reservations.
Without Soothe Bell
Gen 1: 100/0.5 * 255 / 2 + 155/0.5 * 255 = 104,550 steps average
Gen 2: 255/1 * 512 = 130,560 steps on average
Gen 3: 255/0.5 * 128 = 65,280 steps average
Gen 4: 255/0.5 * 128 = 65,280 steps average
Gen 5: 200/0.5 * 255 / 2 + 55/0.5 * 255 = 79,050 steps on average
Gen 6*: 200/0.5 * 128 / 2 + 55/0.5 * 128 = 39,680 steps on average (*assuming 50%)
Gen 7*: 200/0.5 * 128 / 2 + 55/0.5 * 128 = 39,680 steps on average (*assuming 50%)
LGP/E: 200/0.5 * 255 / 2 + 55/0.5 * 255 = 79,050 steps on average
Sw/Sh: n/a (walking cannot increase friendship to max)
BD/SP: 255/0.5 * 128 = 65,280 steps average
Gen 9: not researched yet
With Soothe Bell
Soothe Bell only applies when the happiness boost per n steps is greater than 1, because Pokemon rounds down. This matters for the +2 boost at low happiness in some games, which becomes +3.
Gen 3: 255/0.5 * 128 = 65,280 steps average
Gen 4: 255/0.5 * 128 = 65,280 steps average
Gen 5: 200/0.5 * 255 / 3 + 55/0.5 * 255 = 62,050 steps on average
Gen 6*: 200/0.5 * 128 / 3 + 55/0.5 * 128 = 31,147 steps on average (*assuming 50%)
Gen 7*: 200/0.5 * 128 / 3 + 55/0.5 * 128 = 31,147 steps on average (*assuming 50%)
Sw/Sh: n/a (walking cannot increase friendship to max)
BD/SP: 255/0.5 * 128 = 65,280 steps average
Gen 9: not researched yet
All of this is obviously random. If you have good luck, then you might get a friendship boost every n steps, in which case the number of steps will be lower than the above. If you have bad luck, then it will be higher. We have only calculated averages.