There are some different reasons for that , configuration is one, and I'm guessing you're talking about inline 4's . since that's what we have(back to this later)...... you take a boxer 4 and you can balance a 50 cent piece on it's edge(boxer is the same amount of cylinders pointing to the side 180º of each other). Or you can have a V-4 90º engine and that would be smooth also, not as smooth as a harizional boxer.
Now back to the inline engines, the more cylinders the more points of contact by way of crankshaft there will be , and each(how many) cylinder rods that push the CS the smoother the CS turns along with everything else, ie; a 12 cylinder inline would be smoother than a six, etc. (provided it tuned correctly, but that's for another day)..................