Engine smoothness depends very much on the basic configuration of the engine design - no. of cylinders, how the cylinders are arranged (in-line, V-shape or horizontally opposed) and the V-angle for V-shape engines. In case a less favourable configuration is chosen, probably due to packaging or cost reasons, counter weights or balancer shafts may be used to counter the vibration generated in the price of a little bit energy loss.
Strengthening of the engine block, crankshaft etc. can absorb certain level of vibration and noise. Lastly, the use of lower friction parts can further enhance smoothness and quietness.
Therefore we need multi-cylinder engines. While single-cylinder engine fires once every 2 revolutions, twin-cylinder engine fires once every revolution, 3-cylinder fires once every 720 / 3 = 240° crank angle, 4-cylinder fires once every 180° (half a revolution) .... 12-cylinder engine fires once every just 60° crank angle. Obviously, the more cylinders the engine has, the smoother the power delivery becomes.
This explain why we prefer V12 engines than in-line 6, although both of them achieve near perfect internal balance.
In reality, the direction of vibration is not just vertical. Because the connecting rod is not just travelling upward and downward, but also left and right, there is also some vibration in transverse direction; However, compare with piston, connecting rod is much lighter, thus the vibration generated by the left / right movement of con-rod is also much smaller than the up / down vibration by the piston.
What about multi-cylinder engines? That's much more complicated than imagined. We'd better to discuss case by case.
This is the worse engine configuration for refinement, therefore only the cheapest mini cars in the past employed it, such as Fiat 128, entry-level Fiat Cinquecento and Honda Today etc. Today, I'm afraid there is probably no mass production car still use twin-cylinder engines, not even the smallest Japanese K-cars. Although the displacement of K-cars is 660 c.c. and is theoretically more suitable to twin-cylinder, they employs 3-cylinder or even four-pot to avoid the severe vibration problem of twin-cylinder.
It seems that no matter how the crankshaft rotate, the combined center of gravity of all 3 pistons and con-rods will remain at the same location, hence no vibration generated. By mathematical analysis, you can also find there is no forces generated in vertical direction as well as transverse direction. (actually, I really performed such calculations) So why did we hear that 3-cylinder engine need balancer shaft ?
In fact, the calculation is wrong because it assumes the engine is one point, thus the forces of all 3 cylinders act on this single point and result in complete cancellation. In reality, the forces act on 3 different locations on the crankshaft, thus instead of canceling one another, they make the crankshaft vibrating end to end.
Don’t understand ? look at the above picture, the side view of the engine. Piston 1 is at the top now and is going downward, thus generates an upward force to the left end of the crankshaft. Piston 2 is also going downward, thus generates an upward force to the middle of the crankshaft. Piston 3 is going upward, thus generate a downward force to the right end of crankshaft. As the engine’s center of gravity locates in cylinder 2, you can see forces from piston 1 push the left end of the engine upward while forces from piston 3 push the right end of the engine downward; After 180° rotation, the situation will be completely reversed - downward force at left and upward force at the right. In other words, this is an end-to-end vibration with respect to the center in cylinder 2.
End-to-end vibration (shown here is a V6)
Solution - single balancer shaft
Therefore inline-3 engine is better to be equipped with a balancer shaft, driven by crankshaft. There is a weight at each end of the balancer shaft. The weights move in direction opposite to the direction of the end pistons. When the piston goes up, the weight goes down. When the piston goes down, the weight goes up. Therefore the end-to-end vibration can be counter balanced by the balancer shaft which is driven at the same speed as the crankshaft.