It’s a good question, and one famously reported by Adhemar of Chabannes. King Hugh Capet was fighting Count Aldebert of La Marche, and, when they met, asked him “Who made you count?”, in an attempt to seize the moral high ground. Aldebert replied “Who made you king?”, and it is for that latter that the story is usually remembered, but the former question is perhaps more important. We have a reasonable idea of how Hugh Capet became king having previously been a duke, as it was described in reasonable detail by several sources. How someone becomes a count without coming from a comital lineage is a bit less clear.*
However, a nice little source snippet on this question fell into my lap recently. I was looking at the Vita, or biography, of St. Gerald of Aurillac, and had to deal with the arguments of Matthew Kuefler to the effect that the version most historians are familiar with was written not in the 920s by Abbot Odo of Cluny but after the year 1000 by… well, by Adhemar of Chabannes, actually. I think this is unconvincing, personally, and the question of countship relates to one of Kuefler’s key arguments. He argues (p. 51, as well as elsewhere) that Gerald is referred to as count of Aurillac, but there don’t appear to have been other counts of Aurillac, so this is anachronistic.
However, this rests on the – very Carolingian – assumption that comital office was acquired through administrative mechanisms, that is to say, that one was granted a countship by the king and thus legally became a count. This, though, is not what the text actually says. Key here is Book 1, chapter 27 (not exactly the most up-to-date edition, but the easiest to link to; there’s a translation of the whole thing here):
On the whole route, he was of the highest rank of nobility, and was famous everywhere for his piety and largess. When, therefore, the traders, as is their custom, were going between the tents and asking if anyone wanted to buy anything, some of the better ones came to the lord [Gerald’s] tent, and asked his servants if, perchance, the lord count (for so everyone called him) would command that cloths or spices be bought.
Key here is the ‘for so they called him line’, because what this indicates is that countship was not necessarily legal, but social. By the tenth century, a sufficiently noble, wealthy and powerful man of good repute could be called a count not because of any formal process, but because his social position was sufficient for him to be acknowledged as at the top rank of regional society. There are other examples of this – the early eleventh-century counts of Ponthieu, and I think something similar happens in the late tenth century with the counts of Ternois – but the best example is roughly contemporary with Gerald, in the case of Fulk the Red, count/viscount of Anjou.
Fulk had been made viscount of Anjou in the first decade of the tenth century, and in the context of the region, with its formal hierarchy of rank and relatively tight governance, I think ‘appointed’ is the right way to describe it. He appears in a charter of 929 issued in his own name as ‘count’ not ‘viscount’. Despite this, he signs charters of his superior, Hugh the Great, ruler of the Neustrian March, as ‘viscount’ up through into the 930s. What seems to be happening here is that, in an Angevin context, he was a sufficiently big player by 929 that he could reasonably and plausibly claim to be a count as a marker of his social status, but this did not yet look plausible on a wider stage.
In any case, a focus on the juridical aspects of being a count is potentially misleading here. Late- and post-Carolingian counthood could be flexible, not necessarily always claimed, and fundamentally a matter of social status not legal role.
*In Aldebert’s case, I assumed the answer Hugh intended was ‘the king, i.e. me’, referring to the comital office as royally-constituted. In poking around, I’ve found that Aldebert became count of Perigord (which is how Adhemar refers to him) after capturing and blinding his brother, so the intended answer may well have been ‘no-one’, in which case Aldebert’s response becomes a bit more pointed, given that Hugh gained the throne by imprisoning his predecessor’s uncle…