Präsens — Subjekt (1) → Verb (2) → temporal (3) → kausal (4) → modal (5) → lokal (6) → Objekt (7)
When constructing sentences in German, generally they begin with either the subject or an adverb of time or place. If the subject is not in first position, it must come third in regular sentence order in the present tense, with the minor exception in the case of reflexive verbs (e.g. Heute rasiert sich der Mann.). The verb will come second, followed by adverbs, then time (from general to specific), cause (why, under what circumstances or with which results/consequences), manner (how), location, and, finally, objects. When an indirect object is included, it will be placed after the verb and before any adverbs and other elements. The direct object is typically located at the very end of the sentence; however, when that direct object is a pronoun (ihn, sie, or es), it moves directly to after the verb or in front of the indirect object (if present (see below)).
Der Junge gibt ihr morgen früh in der Bibliothek das Buch zurück. (normal order)
Der Junge gibt es ihr morgen früh in der Bibliothek zurück. (changed order due to acc. pronoun)
In the second sentence, the book (das Buch) is replaced by “es,” which necessitates a change in word order, depositing the accusative pronoun (the direct object) in front of the dative pronoun (the indirect object). This only occurs when the accusative noun/direct object is changed into a pronoun — it does not matter whether or not the dative indirect object is a pronoun, a noun, or a name.
It is worth noting that the temporal, causal, modal, and location elements, as well as objects of a sentence can be moved into different positions to change the meaning slightly, adding slightly more emphasis to those moved to the beginning. Consider the following sentence and its variants (the element of time will move):
Die Frau macht jede Woche aus Gesundheitsgründen regelmäßig im Fitnessstudio Yoga. (time=third (normal))
Jede Woche macht die Frau aus Gesundheitsgründen regelmäßig im Fitnessstudio Yoga. (first)
Die Frau macht aus Gesundheitsgründen jede Woche regelmäßig im Fitnessstudio Yoga. (fourth)
Die Frau macht aus Gesundheitsgründen regelmäßig jede Woche im Fitnessstudio Yoga. (fifth)
Die Frau macht aus Gesundheitsgründen regelmäßig im Fitnessstudio jede Woche Yoga. (sixth)
Technically, all of the above examples are grammatically correct, but the first two are the most common variants. Further, adverbs of time are the most common element to be placed at the beginning of the sentence instead of the subject.