A witch's familiar lends her magical abilities to her master: apprentice witches, regular witches and the coven leader must have a familiar present to cast spells, but can do so without any spell cooldown while their familiar is alive.
Witch's familiars are not randomly generated, and are not a valid form for polymorph.
The witch's familiar is always generated accompanying the witches, apprentice witches and coven leader in the Temples of the Old Gods within the Neutral Quest. A familiar is generated at the same level as her witch, and the witches and coven leader are capable of summoning another if the necessity arises.
The witches' familiars are a primary reason that players should carefully consider line-of-sight when approaching the witch coven: their open wounds spells can deal surprising amounts of damage to a character foolish enough to walk out into the open. Fortunately, they are quite slow at 6 speed and can be rendered ineffective by keeping out of their range.
While a familiar's casting abilities and importance to her witch should make the familiar a priority target in theory, the witches are capable of flying where their familiars cannot, and will approach you over the river while the familiars remain behind in relative safety - this can cause situations involving the coven to get out of hand, and often requires that characters have a high amount of HP and a source of half spell damage to deal with the battalion.
The witch's familiar is partially based on Brown Jenkin, the familiar of Keziah Mason in the 1933 H.P. Lovecraft short story "The Dreams in the Witch House". Brown Jenkin is described as "a small white-fanged furry thing" raised on Keziah's blood, and appears as "no larger than a good-sized rat" in shape, with a sharp-toothed and bearded human face and human hand-like paws. For years, Brown Jenkin haunts the titular Witch House and Arkham in general, terrorizing the denizens and carrying messages between Keziah and the Devil; it also demonstrates the ability to speak all languages. Unlike Brown Jenkin, the witch's familiars of (not)dNetHack are referred to as "she" and "her", and squeak when chatting to them rather than speaking any form of language (at least to the player character).