I have already read many articles on how I can detect spam comments and prevent spamming.
But still I'm not satisfying with it, I just want to know how a spam comment can affect my blog and website rank.
Sometimes people may post comments with a lot of dangerous keywords like casinos, poker, gambling, viagra and linked with low quality sites.
Also sometimes people are using keywords instead of their original name to get the link for their target keywords.
As a result your site or blog with low quality or unnatural links. So it will affect your rankings automatically.
In general, spam is not a good point for SEO but it depends on what spam exactly is on your blog:
1. Useless text showing the user didn't read your article
If spam only represents a text including something like "Thanks for your perfect article!", I don't think it affects SEO of your page. And even if it doesn't provide a relevant comment for your visitors and relevant keywords in relation to your article for your page, it's adding some text on your page and showing to Google the page has been updated (Google likes often updated content). You can also remove the comment if it's totally useless and irrelevant. In two cases, there is no positive or negative impact for SEO.
2. Useful text with a link to an external site
If spam inludes a link to an external site, it's always useful to check this website to see if it's not considered as a "bad" site (poker, viagra...) for Google. If it's a bad site, you can keep the text and remove the link (especially if the link doesn't have the
rel="nofollow" attribute). If you don't remove the link, it can have a negative impact on SEO of your page (Google doesn't like sites which put links to "bad" sites). If you have many links on many pages, it can unfavorably affect SEO of your entire site.
3. Useless text with a link to an external site
In that case, removing the comment is a good practice because it's not relevant for your site or your visitors. If not, it can unfavorably affect your SEO.
Besides what others have mentioned, sometimes spammers post links to websites that contain viral exploits of certain browsers and operating systems. If your site is frequently referring other computers to compromised / dangerous websites you can be considered part of the threat. Your links would also be increasing the PageRank (term used loosely) of the dangerous websites further demoting the credibility of your site.