How to get rid of excess vertices lined up in a straight line
Someonewithpc's answer is almost right. The correct operator for this purpose is located in the same menu, it's the Limited Dissolve. It allows to limit the max angle, so setting the value low enough will remove only the excess vertices on straight edges.