For instance, 4 inline 2.0 litre engine with V6 2.0 litre engine. Do they produce same output in terms of power and torque? One engine built with 4 piston and the other with 6. Would that effect the performance? Open for discussion.
The V-6 will be a much sweeter engine, whether or not it gets more power than an equal displacement 4 inline. And a straight 6 would be even nicer, in terms of vibration-free operation.
At equal displacement, and let's assume (to reduce the variables) that both are naturally aspirated, power and torque would depend on many factors. Generally speaking, the engines would be similar in performance. But for example, increasing the stroke, and consequently reducing the bore, will typically give you more torque but less maximum horsepower. The maximum revs are reduced, when you have long stroke, because the pistons have a longer distance to travel for each revolution. However in order to create the greater stroke, the crankpins have to be offset more from the crankshaft itself, resulting in greater leverage from piston connecting rods to the crankshaft. That greater leverage creates more torque.
So you get more low end torque, but not enough revs to create that high horsepower, which requires high revs.
But again, the number of cylinders per se doesn't make a huge difference to performance. On the positive side, more cylinders will mean greater total piston area, for a given displacement. So that would improve efficiency. (Same calculation that makes 4 valves per cylinder better than two.) On the negative side, you have more frictional losses with more cylinders, so that reduces efficiency.
Automakers seem to have discovered that the best fuel efficiency, in practice, is achieved with turbocharged 4 cylinder engines. That might be true, but 4 cylinder engines, even with balance shafts, simply do not feel as nice as V-6s or inline 6s. Give me a small displacement 6 in favor of a 4 any day.
Agree with Albert, manufacturers mostly consider whether to use V6 or V8 for same volume is by the vibration produced by engine and also engine compartment in the car. But, even though by calculation, the volumetric size of cylinder looks the same, but the characteristic of both engines may different. With different bore size and stroke, it will affect the peak torque/peak power output (may have different peak with different RPM).
If we talk about same cylinder, lets say V8 but different angle, it will also has effect on the vibration. That's why manufacturers nowadays only use one-angle-V8 engine rather than use varying (45,60,90, or etc)-angle-V8 engine.