Normally the coding is depend on the system of what type of spam you want to detect. If you looking for simple one than use filter by keyword.
Absolutely, based on the content , and to how many user id the forward ? sometime it filters from the site name which are already indexed as spams
Sometimes it's determined by the judging rules on the server.Different server may have different criterion on spam.
Well, Spam Filtering, A guide to help stop spam and reporting spammers including what is spam, how they get your email address and how you can help stop it.