In the sentence "Die Polizei folgt dem Täter," it seems like Täter should be in the accusative case since it seems to be receiving the action of the verb "folgt." Why is it instead in the dative case? This sentence is taken directly from Lingvist.
Identifying the "direct object" that seems to receive the action of the verb is not a 100% reliable criterion (in German) to evaluate whether your object has to be in accusative.
You can try to use that rule in conversation (then somebody will correct you if the case is wrong), but if you write, the best you can do is to learn it by heart. Go to a dictionary, and you will find the case to the verb, usually in the form
verb + jemanden/etwas+Akk for accusative,
verb + jemandem/etwas+Dative.
I want to add that the rule is actually pretty reliable.
Even in this case, it holds that
verfolgen is in accusative, since it receives the action of the verb, as you said.
However, the word
folgen can have a slightly different meaning: Let's say you're invited, your host shows you the way to the living room and you follow him or her. So that's a thing you kind of do together. In this case you would use
verfolgen implies that the object of the sentence is not supposed to know or doesn't want that you follow it (unless it wants to trick the follower or the like). So here, the subject of the sentence rather enforces sth. on the object.