The answer depends on who you ask. The structural engineer would prefer a single wheel, and as few legs as possible, while the aerodynamicist would vote for 8 or 12 wheels, because then the bogie has less frontal area and can be accommodated even in thin wings.
Generally, less than two wheels would compromise redundancy, and more are needed to reduce local ground pressure. Remember that the A-300B was initially not allowed on some US airports because of a slightly higher ground pressure. See this answer for more.
Modern designs use two wheels per strut for redundancy when the aircraft is light enough and replace them with a bogie with as many wheels as necessary to carry higher aircraft masses. The A-340-200 has gained a central strut with two wheels (A-340-200/300) rsp. a 4-wheel bogie (A-340-500/600), while the equally large, but lighter A-330 uses just the two 4-wheel main gears without the central gear. Airbus could have used two six-wheel bogies, but preferred to keep commonality with the A-330 gear.
More than 6 wheels per bogie is very unusual, but there are exceptions: Since the Tu-144 had no thrust reversers, all braking had to be done by the wheel brakes. Additionally, the bogies needed to fit between the intake ducts inside the nacelles, so the final design used 8 wheels with the large housings of the disc brakes sticking out towards the center of the bogie. As @Zeus points out in the comments, these were more precisely 4 dual-tire wheels per bogie: The two tires on each side were mechanically linked.
Tupolev Tu-144 landing gear (picture source). This particular aircraft is parked in the back yard of the Aviation Institute in Kazan. If you want to know how this 8-wheeled monster would fit inside a supersonic airliner, read the answers to this question.
XB-36 (first prototype of the B-36) taking off (picture source)
Convair experimented with different tire sizes for the B-36 and even a tracked version. The initial single wheel design resulted in the biggest aircraft tire ever produced, but in the end the conventional (but novel at this time) 4-wheel bogie was preferred because the single wheel had too much ground pressure for most US airbases. Earlier airplanes had used 2-wheel bogies (Tupolev TB-3, Junkers G-38) or a pair of wheels left and right of the strut (Douglas DC-4). Very early large aircraft had to use what was available, so the Caproni 42 bomber of 1918 below had as many main wheels as the TU-144 half a century later (picture source). The Zeppelin Staaken giant aircraft of WW I used the same number of main wheels on a single axle for soft field operations.
When Air India ordered their first A320s, they were afraid the main wheel pressure would be too much for some Indian airfields. Airbus produced a version with a four-wheel bogie instead of the usual two-wheel main gear of the regular A320. When they later ordered the A321, India seemed to have improved their airfields, because the newer planes use the regular two-wheel gear which is mechanically simpler and needs less maintenance.
Air India A320 (picture source)