After reading about how complex is to paint a bicycle frame, I wonder, why is this done at all? Steel frame obviously needs painting as it may rust. Aluminum or say titanium does not rust in similar ways and the color is not much worse than black. Are there only aesthetic reasons for painting or this is actually useful in other ways?
Not only does aluminum oxidize, it can completely decompose. It is not just some surface film, the structural integrity can be broken and the part can become fragile.
This is well known by climbers and especially cavers, because carabiners or bolt hangers oxidized to a significant degree are a common sight in certain regions (depending on the chemical composition of the rain, the rock and closeness to sea and also on temperature - in Alpine caves and cold mountain walls they do not rust too fast).
It is vital to protect the metal of climbing items that are left outdoors or in a cave if possible, by painting or by anodising. Many bikes are not left outside, but still are brought home wet or even contaminated by road salt and the galvanic corrosion is a danger for both the climbing equipment and bicycles.
That said, some surfaces do often feature naked aluminium alloys, most often the rims, especially with rim brakes. Disc brake rims are often painted as well as the rest of the bike. One should just be aware that corrosion can happen, but bikes that are taken care of or stored inside should be fine. The most danger there is probably in damp hot areas at the sea.
The other answers (to date) explain the very good engineering reasons to paint aluminum. However, cosmetics is a huge part of bike sales, especially the upsell and 'this year's model' game. Many bikes get no more than a color change between model years, and few bikes do not get a color change even with major component upgrades. Without the color change, the component upgrades would lose value on the shop floor. Many (I suspect most) bicycle buyers are interested in how their bike looks. Two types - the casual who wants a nice-looking bike, and 'One of those' types - when he (it's mostly 'he's') takes on its first ride, will his mates swoon over the new model - hopefully enough he has to wipe the drool off the bike.
I imagine even if aluminum did not benefit from painting, most bikes would still be painted.
Adding to Michael's comment, it should also be noted that aluminum, in fact, oxidizes as any other metal, with the notable difference that its oxides create a film that prevents the aluminum underneath to corrode and stick quite well to its surface. Al corrosion can happen in many ways.
- Electrochemically, i.e. when in touch with other metals (this is called Galvanic corrosion and is what Michael was talking about.
- If the atmosphere is acidic, it can suffer from pitting corrosion which is not harmful to the mechanical properties of the frame but can cause aesthetic issues.
- Also areas around holes or subjected to mechanical stress can host pockets of water that can harm your frame. There are other ways in which Al can corrode, however in my opinion these might be the most important ones.