The prescriptive rule is that, when a declarative sentence is made into a causative one, its erstwhile subject is demoted to the next free slot in the argument structure (Subject > Direct Object > Indirect Object (à) > Oblique Object (par/de). In some cases, the ex-subject can drop to a lower spot than the first free one.
With less lingo and more examples:
For a transitive verb:
Le bébé s'est endormi (The baby fell asleep)
Il s'est endormi
La berceuse a fait s'endormir le bébé (the nursery song made the baby fall asleep)
Elle l'a fait s'endormir
In the causative constructive, it's berceuse that fills the subject slot, which displaces bébé, making it drop to the direct object slot.
For an intransitive verb:
Les élèves ont lu l'article (The pupils read the article)
Ils l'ont lu
La prof a fait lire l'article aux élèves
Elle leur a fait lire l'article (1)
As both the subject and direct object slots are filled (by la prof and l'article, respectively), les élèves drops to the indirect object slot.
It's also possible to mark les élèves with par instead:
La prof a fait lire l'article par les élèves
But this is not very common.
For an intransitive verb used without an object:
Two constructions are possible:
Les élèves lisent (the pupils read)
La prof fait lire les élèves (Elle les fait lire)
La prof fait lire aux élèves (Elle leur fait lire)
Transitive verbs used intransitively can either follow the intransitive construction (the demoted subject ends up as a direct object) or the transitive construction (the demoted subject ends up as an indirect object)
With three arguments verbs:
Le garçon sert aux clients leurs verres (The barman serves their drinks to the clients)
Il les leur sert
Le patron fait servir leurs verres aux clients par le garçon (The bar-owner makes the barman serve their drinks to the clients)
Le patron fait servir leurs verres aux clients par lui
As all three central argument positions are filled, the logical subject of servir ends up marked as an oblique agent.
The rule, once understood, is actually quite simple, but exceptions like what happens with transitive verbs without an object or the à/par alternation can make the input quite confusing for a learner.
Furthermore, the actual usage of French speakers can diverge from these rules. Because the direct object is a grammatical role mostly used for inanimates affected by the action of the verb, it can be an awkward role to assign to an agentive human being (and the demoted subject of a causative construction is almost always highly agentive), so you'll hear sentences like those bellow with some regularity:
Je lui ai fait dormir (I made him sleep)
Je lui ai fait se dépécher (I made him hurry up)
Because the indirect object is a much more usual grammatical role for humans, it's preferred to that of direct object.
Some speakers might also not follow the demotion chain to the end, and leave the demoted subject in an already filled spot. This is mostly restricted to cases when it's a pronoun and cooccur with a full noun phrase:
Elle les a fait lire l'article (where les is les élèves)
Le patron lui fait servir leurs verres aux clients (where lui is au garçon)
If you want to use a causative construction as a learner, just stick to the prescriptive rules and ignore even the prescriptively licit exceptions, at least at first, because this is the simplest way to form the construction.
(1) There are two options to pronominalize l'article: Elle le leur a fait lire and Elle leur a fait le lire