As shown in the picture, straight-6 engine is simply two 3-cylinder engines mated symmetrically together, thus piston 1 is always in the same position as piston 6, piston 2 the same as piston 5 .... in other words, the engine is balanced end-to-end and requires no balancer shaft, unlike 3-cylinder engines.
What about vertical / transverse forces? like 3-cylinder engines, the vertical and transverse forces generated by individual cylinders, no matter first order or second order, are completely balanced by one another. The resultant vibration is nearly zero, thus inline-6 is virtually a perfect configuration.
Inline-6 is not the only configuration can deliver near perfect refinement, but it is the most compact one among them. All boxer engines are perfectly balanced, but they are two wide and require duplicate of blocks, heads and valve gears. V12 engines also achieve perfect balance, but obviously out of the reach of most mass production cars. Automotive engineers knew that long ago, that’s why you can see most of the best classic engines were inline-6, such as Rolls-Royce Silver Ghost, Bentley Speed Six, Mercedes SSK, many Bugattis, Jaguar XK-series and BMW’s various models.