Many pre-Christian European mythologies contain a dog or dog-like creature which is intimately associated with death, and in particular with the land of the dead. It is likely for this reason that a large black dog has often been claimed, in more recent centuries, as an ill omen, and they persist in similar forms in folklore to the present day.
A canine guardian for the world of the afterlife has been proposed as a possible proto-Indo-European mythic element, based on the fact that it shows up in several descendant traditions. The Greek Kerberos is a three-headed dog which guards the gates of Hades, while the gates of Hel in Norse myth are watched by Garmr, also a dog. The Welsh Cwn Annwn are, literally, the Dogs of the Netherworld, and while they do not serve a guardian function they do have a specific association with death and the afterlife.
The Cwn Annwn are pure white in color, except for their red ears. They take part in the Welsh version of the Wild Hunt on particular nights, and their bay is sometimes regarded as a portent of death when it grows silent. (The legend holds that they sound louder the further from them you are, and that as they draw near the sound gets fainter.) They are also said to be responsible for carrying souls of to Annwn, the otherworldly paradise of Welsh myth.
The echoes we wee today, however, take this tradition in a different direction. Spectral dogs of the British Isles (most prevalent in England) are uniformly black, and are typically regarded as a malign apparition. In some local traditions they are, again, an ill omen; in others, they drive travelers off a safe path. (A few stories tell of benevolent black dogs instead, which guide people along a safe route.) They are always large, ranging in size from mastiff-like to nearly the size of a cow, depending on the telling. The locals may know the ghostly dog well enough to have given it a name - the Barghest, Old Shuck, Black Shuck, Padfoot, the Grim, or (in Scotland) the Cu Sith, among others. A few versions are headless, such as the Devonshire "yell hound" and the Guernsey "Tchico," but these can still be heard barking all the same; the rest generally seem to have glowing red eyes. They are seen almost exclusively at night.
The phenomenon isn't a uniquely British one, even in the present day; Catalonia has a tradition of the "Dip," a black dog, lame in one forepaw, which is said to be the hound of Satan himself out looking for sinners' souls to catch and drag off to Hell. The Walloon "Tchen al Tchinne" (lit. "Chained Dog") and Central American "Cadejo" are both said to drag a chain behind them; a Flemish version of the legend, which seems to have died out sometime in the past two centuries, fit the British model precisely, complete with the notion that sighting one was a death omen.
But sightings are not rare (then again, neither were deaths in the extended family, especially before modern medicine), and the earliest well-documented ones go back to the early modern period. One might be tempted to attribute them to the tendency for the human eye to play tricks on us in poor lighting, but the nature of the manifestations is not cross-cultural - except for one instance in which a similar legend is found in Central America, black dog sightings are almost exclusively confined to Europe. More likely, then, is the fact that when our eyes do feed our brains incomplete or inaccurate information as a result of insufficient light, the form which we give it is subject to a certain cultural influence - and to many Europeans, now most especially the English, a natural and especially sinister form to hallucinate is that of a large black dog, warning of death or ready to drag an unwary soul to an early grave. That cultural feature may be a distant memory of a canine guardian of the netherworld - a guardian who, in some form, still haunts the imaginations of those who walk fearfully through the darkness.