In the olden days, search engines simply used to depend on the number of times a keyword used in the article to rank it.
But people started abusing it to cheat search engines by simply stuffing keywords and using non-relevant keywords in the content to get the attention of search engines.
You may find some people writing articles like this, just to trick search engines:
If you are looking for information on Coffee recipes, read this article which is written on the topic coffee recipes. This coffee recipe article is an excellent coffee recipe article. This coffee recipe article will help you make good coffee. This coffee recipe is an easy way to make coffee. In this coffee recipe article, you can find lot of information on making coffee. This coffee recipe article talks about which are the best coffee beans, where to buy coffee beans, how to make good coffee etc. Read this coffee recipe article to learn more about making coffee.
Don't feel it very uncomfortable to read it because of the overuse of the keyword 'coffee recipe' in it?
In the olden days where search engines were only counting the number of times the keywords were used, this kind of repeated use of keywords used to do the trick. But not any more.
Search engines have become smart. They will easily detect this kind of overuse as tricks to cheat search engines to get better ranking.
Adding keywords too many times for the purpose of making the search engines rank high on that keyword is called "Keyword spamming".
If search engines detect the use of keywords as keyword spamming, it will give negative points to that article for that keyword and search engine ranking of the page and site will go down.