The sourcebook on this is Deities & Demigods, which officially leaves it up to the DM:
Gods are immortal beings with power beyond mortal capabilities. You decide where they come from.
However, there is precedent for becoming a deity simply by number of followers. In Vecna Lives, Vecna is slain by his lieutenant, only to be reborn centuries later as a deity after a cult grows and begins to worship him. In Age of Worms, cultists manage to summon a demon in the shape of a fake god. And in Ivid the Undying, a pit fiend becomes a deity by having a dictator install him as the state religion.
The rules for divine rank also suggest that deities with more followers have more power. Age of Worms suggests that there's a causative link, with a rank 0 deity who becomes more powerful depending on the number of people who fear his return.
In general, however, creating deities isn't something player characters do a lot, so there aren't any real mechanics on it (aside from divine rank, which you can find in Deities & Demigods or the divine rules in the SRD). The DM is free to decide whether or not deities can be created through sufficient faith in their world.