An engine is a machine which burns fuel and delivers useful work. To do this, air and fuel enters through camshaft controlled inlet valves, burns and the expanding gases force the piston, which is below the valves, to move down in the cylinder bore. This motion is transferred to the crankshaft, below the piston, which is connected to it by the connecting rod, and this drives our cars. The burnt gases are expelled by the exhaust valves and the cycle repeats. This is the simplest form of an engine, a single cylinder, think 100cc bikes on Indian roads.
There is a limit to how fast a single cylinder engine can run, and installing a bigger piston (more weight) for more power works only up to a point. To extract more useful work we can add one more cylinder in parallel, for example. Two smaller pistons will turn faster than a large one and we can get more power, this is a parallel twin (like in the Ninja 250R). If we keep adding more cylinders we get Triples (Triumph), Fours (most hatchbacks), Fives (Volvo S60 D5), Sixes (BMW 335i), but straight-eights are very rare now because they consume a lot of space. Advantage of straight engines is that they are easy to manufacture and maintain, eager to rev, they tend to deliver more power at higher revs, and camshaft and valve trains are of simple design.
But tacking on cylinders in a line means lots of space is required – there are alternative cylinder arrangements. If we join two of them at an angle opposite each other, we get a V-twin, think Harley-Davidson. If we join them exactly opposite to each other such that they form a straight line, we get Boxers, think BMW R1200GS (two cylinders) and Porsche 911s (six cylinders).
Advantage of Vs and Boxers is that, they are compact, engine vibration is balanced out by opposite bank of cylinders, fuel and air induction equipments are accommodated between the opposite banks of cylinders, hence efficient packaging. In the same vein, we have V4s (think VFR 1200F), V6s (Audi 3.0 TFSI ), V8s (458 Italia), V1Os (Gallardo), V12s (Enzo) and V16s (Cadillac V-16). But again, V16s are rare. Volkswagen, then went on to join two V6s such as to share a common crankshaft and we got a W12 (think Continental GT), advantage being the power of 12 cylinders in almost the length of a inline triple. Space is, obviously, not the only consideration and engine formats are chosen for their nature, especially in the faster cars and motorcycles. V-twins make loads of torque, V4s find a great balance between torque and high-rev power, inline-fours typically like revving fast and high, sixes (inline and V6s) can be tremendously smooth while V8s are famous for their brilliant sound as well as great power and smoothness and so forth.
That in a nutshell, is the internal combustion engine in basic structure and configuration.