Decades ago when vector photo plotters with an aperture wheel were used you could only use those pads sizes and shapes that were present on the wheel. With only about 32 different apertures you could not chose between round, square and octagons.
But nowadays raster photo plotters are used and you may programm the sizes and shapes you wish. You may also use pentagons and hexagons if you like as long as your PCB CAD system supports them. Even heptagons and nonagons are possible. Triangles are possible too but their area is too small compared to a round pad.
A round pad leaves more space for routing as a square pad. The octagon is a compromise between square and round. Routing traces not only with 0° and 90° but also with 45 ° fits better to octagon pads than to square or heaxgon pads.
You might use those different pad shapes for marking of some pins, for instance pin 1 of an IC square, all others round. For polarized capacitors you may use different pad shapes for the + and - pin, same for diodes. If you want to use those different shapes for marking use only those easily recognized without a magnifying glass.