A quantum point contact (QPC) is a basic nanometre-scale electronic device: a short and narrow transport channel between two electron reservoirs. In clean channels, electron transport is ballistic and the conductance is then quantized as a function of channel width(1,2) with plateaux at integer multiples of 2e(2)/h (where e is the electron charge and h is Planck's constant). This can be understood in a picture where the electron states are propagating waves, without the need to account for electron-electron interactions. Quantized conductance could thus be the signature of ultimate control over nanoscale electron transport. However, even studies with the cleanest QPCs generically show significant anomalies in the quantized conductance traces, and there is consensus that these result from electron many-body effects(3,4). Despite extensive experimental and theoretical studies(4-11), understanding these anomalies is an open problem. Here we report that the many-body effects have their origin in one or more spontaneously localized states that emerge from Friedel oscillations in the electron charge density within the QPC channel. These localized states will have electron spins associated with them, and the Kondo effect-related to electron transport through such localized electron spins-contributes to the formation of the many-body state(5-7). We present evidence for such localization, with Kondo effects of odd or even character, directly reflecting the parity of the number of localized states; the evidence is obtained from experiments with length-tunable QPCs that show a periodic modulation of the many-body properties with Kondo signatures that alternate between odd and even Kondo effects. Our results are of importance for assessing the role of QPCs in more complex hybrid devices(12,13) and for proposals for spintronic and quantum information applications(14,15). In addition, our results show that tunable QPCs offer a versatile platform for investigating many-body effects in nanoscale systems, with the ability to probe such physics at the level of a single site.