New version available here: vedabase.io

Bg 17.4

yajante sāttvikā devān
yakṣa-rakṣāṁsi rājasāḥ
pretān bhūta-gaṇāṁś cānye
yajante tāmasā janāḥ
Synonyms: 
yajante — worship; sāttvikāḥ — those who are in the mode of goodness; devān — demigods; yakṣa-rakṣāṁsi — demons; rājasāḥ — those who are in the mode of passion; pretān — spirits of the dead; bhūta-gaṇān — ghosts; ca — and; anye — others; yajante — worship; tāmasāḥ — in the mode of ignorance; janāḥ — people.
Translation: 
Men in the mode of goodness worship the demigods; those in the mode of passion worship the demons; and those in the mode of ignorance worship ghosts and spirits.
Purport: 

In this verse the Supreme Personality of Godhead describes different kinds of worshipers according to their external activities. According to scriptural injunction, only the Supreme Personality of Godhead is worshipable, but those who are not very conversant with, or faithful to, the scriptural injunctions worship different objects, according to their specific situations in the modes of material nature. Those who are situated in goodness generally worship the demigods. The demigods include Brahmā, Śiva and others such as Indra, Candra and the sun-god. There are various demigods. Those in goodness worship a particular demigod for a particular purpose. Similarly, those who are in the mode of passion worship the demons. We recall that during the Second World War a man in Calcutta worshiped Hitler because thanks to that war he had amassed a large amount of wealth by dealing in the black market. Similarly, those in the modes of passion and ignorance generally select a powerful man to be God. They think that anyone can be worshiped as God and that the same results will be obtained.

Now, it is clearly described here that those who are in the mode of passion worship and create such gods, and those who are in the mode of ignorance, in darkness, worship dead spirits. Sometimes people worship at the tomb of some dead man. Sexual service is also considered to be in the mode of darkness. Similarly, in remote villages in India there are worshipers of ghosts. We have seen that in India the lower-class people sometimes go to the forest, and if they have knowledge that a ghost lives in a tree, they worship that tree and offer sacrifices. These different kinds of worship are not actually God worship. God worship is for persons who are transcendentally situated in pure goodness. In the Śrīmad-Bhāgavatam (4.3.23) it is said, sattvaṁ viśuddhaṁ vasudeva-śabditam: “When a man is situated in pure goodness, he worships Vāsudeva.” The purport is that those who are completely purified of the material modes of nature and who are transcendentally situated can worship the Supreme Personality of Godhead.

The impersonalists are supposed to be situated in the mode of goodness, and they worship five kinds of demigods. They worship the impersonal Viṣṇu form in the material world, which is known as philosophized Viṣṇu. Viṣṇu is the expansion of the Supreme Personality of Godhead, but the impersonalists, because they do not ultimately believe in the Supreme Personality of Godhead, imagine that the Viṣṇu form is just another aspect of the impersonal Brahman; similarly, they imagine that Lord Brahmā is the impersonal form in the material mode of passion. Thus they sometimes describe five kinds of gods that are worshipable, but because they think that the actual truth is impersonal Brahman, they dispose of all worshipable objects at the ultimate end. In conclusion, the different qualities of the material modes of nature can be purified through association with persons who are of transcendental nature.