Suppose the leg spacing for a square and triangular chair is the same then the positions of the legs look like:
If we call the leg spacing $2d$ then for the square chair the distance from the centre to the edge is $d$ while for the triangular chair it's $d\tan 30^\circ$ or about $0.58d$. That means on the triangular chair you can only lean half as far before you fall over, so it is much less stable. To get the same stability as the square chair you'd need to increase the leg spacing to $2/\tan 30^\circ d$ or about $3.5d$ which would make the chair too big.
A pentagonal chair would be even more stable, and a hexagonal chair more stable still, and so on. However increasing the number of legs gives diminishing increases in stability and costs more. Four-legged chairs have emerged (from several millennia of people falling off chairs) as a good compromise.
The problem is, that the bearings are not perfect. Especially the ones that are used to turn the "feet" of the chair. Those bearings are under a quite heavy load, and they are not designed to turn without friction.
As such, your chair's feet always want to remain in the same position as they are, and that is usually not exactly the direction into which you want to move your chair. Frequently, you cannot move into any direction without turning some feet.
So, when you push your chair back, the feet of the chairs basically hold a contest on who's the first to turn. Now, like all the feet, the ones that remain in position relative to the chair's base, are generally not aligned with your movement either, and they provide the chair's base with some rotating force.
You can make the test of aligning all five feet straight to the back, and then slowly drawing the chair back. You'll see that you'll be able to move the chair for some distance without the base turning. However, once the imperfections of the setup amplify, one or more feet become significantly out of direction, and that's when the chair's base will start turning.
Best Answer
Consolidating some of the points made in the answers to the question you linked, and comments:
When constructing a chair, 4 legs is easy when you use traditional (wooden) construction - 90 degree angles, and easy to make stackable. A little bit harder than three legs because you have to make sure they are all the same length (or the chair will wobble).
Once you have a "office chair" with a hydraulic center post, the construction argument goes away. That leaves us with greater freedom to pick number of legs. The considerations are:
All engineering design is a question of tradeoffs; in this case, I think that the first point argues for fewer legs, and the second / third point for more legs. The question then becomes: what is the additional value, and the additional cost, of one more leg? Below, I calculate the cost of adding more legs for the same stability and cost - this makes some assumptions but concludes five is indeed optimal.
But there is another important factor (tip of the hat to my daughter for this concept): when the floor is uneven, a chair will be not be supported by all its legs - it will "wobble". Now if you have four legs, this wobble will happen along one of the diagonals of the square, and this line will be below (or very close to) the center of gravity. That makes the energy needed to go from one side to the other very small. When you have five legs, the center of gravity is always displaced relative to the line of support. So five legs provide greater stability on an uneven floor. As you add more legs, the "diagonal of support" gets close to the center. Even numbered regular polygons always have the potential of having the line of support going through the center, making them the worst choice (incidentally this shows that a trapezoidal arrangement of four legs is slightly better than a square... you will sometimes see that, and now you know why).
All of that makes five the optimal number of legs - good stability in all directions. Note that from a construction perspective, it only makes sense to give a chair five legs when you start with a (metal or plastic) center post - the older (square wooden legs) construction makes four a more sensible number as the other answer stated. Once you want the chair to have vertical adjustment, a single center post makes sense - and then you have the flexibility to choose the number of legs.
Finally, a reference from a large supplier of office furniture:
UPDATE
I thought more about the problem of optimization, and think I can explain that five legs is best.
Assume that the chair has to support a constant weight $W$, and that we want a constant stability. Stability is determined by the shortest “tipping distance” $D$. For a radial distance $R$, a chair with $n$ legs has
$$D = R \cos\frac{\pi}{n}$$
So we can define a “stability factor” $S=\frac{1}{R\cos\frac{\pi}{n}}$
Thus, for constant $S$ we get $$R\propto \frac{1}{\cos\frac{\pi}{n}} \tag1$$
Next, we look at the stress on each leg. The stress will be greatest when the tipping torque $\Gamma$ is directly in line with just one leg. At that point,
$$\Gamma = W\cdot R$$
Now we want to calculate the shape (section) of the leg that can support this torque. The maximum stress $\sigma$ for a rectangular beam of width $w$ and height $h$ is proportional to $wh^2$, and the mass of the leg of length $R$ is $whR\rho$; if we assume a constant aspect ratio $\frac{w}{h}$, then mass is proportional to area times length:
$$m \propto h^2 R \tag2$$
where the first term is a function of the strength, and the second term a function of the stability.
Similarly, for given torque $W\cdot R$ we can write the bending stress as
$$\sigma = \frac{My}{I}$$
where $M$ is the bending stress, $y$ is the perpendicular distance to the neutral axis, and $I_x$ is the second moment of area about the neutral axis $x$. For a rectangular section, $y \propto h^4$.
For constant $\sigma$, the maximum will occur at the outer edge of the beam where $y=\frac{h}{2}$, leading to
$$h^3 \propto W\cdot R$$
For given weight $W$, it follows that
$$h\propto R^{1/3} \tag3$$
Substituting $(3)$ into $(2)$ we get
$$m \propto R^{5/3}$$
For constant breaking strength, we get the total mass of $n$ legs:
$$M = n\cdot m \propto n R^{5/3}$$
For constant stability, we use $(1)$ to obtain
$$M \propto \frac{n}{\cos^{\frac53}\frac{\pi}{n}}$$
We can evaluate this for n between 3 and 7, and obtain $M$ as a function of the number of legs:
This shows that indeed the structure with five legs needs the lowest mass to support a certain torque - if we can equate "mass" with "cost", and stability is indeed the main driver, this proves that a chair with five legs is optimal.