Why do Ravens hang around in cemeteries? If you read the answers posted across the net you will find that the crow family (which contains Ravens as the large scruffy cousins) are thought to be the escorts of souls to the afterlife.
Realistically, Crows and Ravens are carrion eaters, and are attracted by the smell of death.
They are beautiful birds, and apparently highly intelligent, for birds anyway. Finding one perched on a gravestone was an open invitation.