It is not so much about telling the difference between a good and bad spirit but between someone who has successfully passed over to the other side and an earthbound spirit or ghost. When people die they do not necessarily miraculously take on an amazing personality change if they were particularly nice or nasty in life, but it does help if they have made a full and successful transition to the other side.