A refined engine should be smooth, free of vibration and quiet. These qualities also help the engine to spin freely at high rpm, raising the red line, and hence possibly power.
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 the case where 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 the price is a little bit of 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.
A cylinder takes 720° crankshaft angle (i.e., 2 revolutions) to complete 1 cycle of 4-stroke operation. In other words, it fires once every 2 crankshaft revolutions. Only the power stroke (expansion stroke) generates positive power, while intake stroke, exhaust stroke and compression stroke consume power, especially the latter. Therefore a single-cylinder engine generates power in the form of periodic pulse. The below picture shows how the power be delivered:

To smooth the power delivery, all engines employ a flywheel, using its inertia to keep the engine running roughly at constant speed. Of course, the heavier the flywheel, the smoother the power delivery becomes, but it also makes the engine less responsive. Therefore the pulsation manner of the engine cannot be completely eliminated by a reasonably large flywheel.
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 = 270° 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 explains why we like the delivery of a V12 engine over an in-line 6, although both of them achieve near perfect internal balance.
Vibration is caused by the movement of the internal parts, especially are pistons and connecting rods. The piston and con-rod move up and down periodically without counter balanced by other means. If the engine is a single-cylinder engine, it will jump up and down periodically as well.
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, compared with piston conrod up down combination, the connecting rod is much lighter and movement shorter, 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 can be imagined. We will look at them case by case.