I've wandered into some dungeon and encountered some necromancers or bandits. I killed some with sneak attack by bow and some turned hostile and they rush to me and I killed them directly. When I sleep, there are no Dark Brotherhood members approaching me. Why?
According to the Elder Scrolls wiki,
you must murder someone in cold blood. In other words, you must murder an innocent without provocation (note that Bandits and the like do not count as the required murder). Once the deed is done, regardless of who is there, the cryptic message "Your killing has been observed by forces unknown..." will appear in the corner of your screen, indicating you will be visited the next time you sleep.
Basically any non-essential NPC will do. (Note that unlike in Morrowind, Oblivion's predecessor, you cannot kill an essential NPC, so you don't have to worry about killing the "wrong" person. If an NPC is involved in a quest you haven't completed, you won't be able to kill them.) If you are looking for a specific set of targets, the wiki has a list of them. I've listed a few of the best targets below:
-- The Skooma Den in Bravil has 4 residents, 3 with 0 responsibility, so your crime will likely go unreported.
-- Camonna Tong Thug: Killing one of the two Camonna Tong thugs at Walker camp will give you no bounty, as they both have low responsibility. If you attack one of them before he attacked you, killing him is counted as a murder, and will allow you to join the Dark Brotherhood. They both respawn in a few days, as well.
-- Alval Uvani has a rather low responsibility, and since he does a lot of traveling (see the Dark Brotherhood mission A Matter of Honor for details) it's rather easy to dispose of him on the road without witnesses. The benefit of killing Alval is that you will have already completed one of the later Brotherhood missions.
The one you kill must be an innocent. I wanted to do the Brotherhood quest early in the game because it bugs me to be a murderer. So, I killed that drug dealer (sells skooma and poisons at night) who stands outside the north wall of the Imperial City, but even though he had not gone aggro on me, his death did not count. Just thought you might like to know how some characters don't qualify at all.