There are a couple of ways to approach Halflings in a D&D game.
-They replace Half-Elves and Half-Dwarves (the other half being human). The Lightfoot combine the rustic nature of some humans with the nimbleness and fey appreciation for nature of the Elves, while the Stout combine Dwarven solidity with human curiosity.
-They replace/merge with Gnomes. Traditionally, Gnomes are more about craft while Halflings are more about agriculture, but your world could have the same race/subspecies occupying both niches. Or they could be offshoots of the same race.
-They're the good-aligned mirror of Kobolds. If cruel Orcs are twisted Elves, martial Hobgoblins are monstrous humans, and tunnel-dwelling Goblins the rivals of Dwarves, perhaps the small and mischievous Kobolds have their equivalent in the more sedentary Halflings. This might not jibe with the current thinking of not making entire races evil, but if their creator gods or rulers are, and their function is to provide slayable opponents, they should at least fit into some sort of cosmology and ecosystem.
-They're a subrace of humanity. It always bugged me that the official, "kitchen sink" settings felt that every Player Character option had to have a culture and homeland, leading to some very crowded worlds. Sure, some cities might be cosmopolitan, but perhaps the different "races" are just that -- people with slightly different physical and cultural characteristics that developed in relative isolation.
-They're not magical. Sure, humans aren't either, but some have a talent for spellcasting. Perhaps Halflings were created by some deity to resist magic (like Dwarves, but less craft-oriented). I could see them making decent Druids with some magical resistance. I agree with the posters who noted that Halflings are meant to be the simple, cheerful counterpoint to the powerful and dark aspects of other characters.
-They're stand-ins for medieval English peasants. As others on this thread have noted, if you have analogues for different historical cultures in your world, you can simply assign them one. For example, the High Elves are Celtic aristocrats, the Dwarves are Slavic nomads, and Gnomes Germanic guildspeople. You can also give your humans different cultural overlays and mix and match.
Each campaign is a mix of the sources the D.M. chooses and the options the role-players like. Your world doesn't have to have Halflings, but Warrows, Brownies, Hobbits, and Podlings are a popular fantasy trope.