The law of cycles and its corollary the law of transmigration or karma, is one of the cornerstones common to all philosophies and sects of Hinduism. Although the Lord is the one who metes out the results of karma, He is not its cause. Each individual jiva is responsible for their own karma. You reap what you sow. When the effect of a particular karmic action is meted out by the Lord is known only by the Lord. In the following quotes from the Brihadaranyaka Upanishad verses IV.iv.5-6, only part of the commentary is quoted below. Please see the following link for the complete commentary (here - https://www.wisdomlib.org/hinduism/book/the-brihadaranyaka-upanishad/d/doc122058.html):
स वा अयमात्मा ब्रह्म विज्ञानमयो मनोमयः प्राणमयश्चक्शुर्मयः श्रोत्रमयः पृथिवीमय आपोमयो वायुमय आकाशमयस्तेजोमयोऽतेजोमयः काममयोऽकाममयः क्रोधमयोऽक्रोधमयो धर्ममयोऽधर्ममयः सर्वमयस्तद्यदेतदिदंमयोऽदोमय इति; यथाकारी यथाचारी तथा भवति—साधुकारी साधुर्भवति, पापकारी पापो भवति; पुण्यः पुण्येन कर्मणा भवति, पापः पापेन । अथो खल्वाहुः काममय एवायं पुरुष इति; स यथाकामो भवति तत्क्रतुर्भवति, यत्क्रतुर्भवति तत्कर्म कुरुते, यत्कर्म कुरुते तदभिसंपद्यते ॥ ५ ॥
sa vā ayamātmā brahma vijñānamayo manomayaḥ prāṇamayaścakśurmayaḥ śrotramayaḥ pṛthivīmaya āpomayo vāyumaya ākāśamayastejomayo'tejomayaḥ kāmamayo'kāmamayaḥ krodhamayo'krodhamayo dharmamayo'dharmamayaḥ sarvamayastadyadetadidaṃmayo'domaya iti; yathākārī yathācārī tathā bhavati—sādhukārī sādhurbhavati, pāpakārī pāpo bhavati; puṇyaḥ puṇyena karmaṇā bhavati, pāpaḥ pāpena | atho khalvāhuḥ kāmamaya evāyaṃ puruṣa iti; sa yathākāmo bhavati tatkraturbhavati, yatkraturbhavati tatkarma kurute, yatkarma kurute tadabhisaṃpadyate || 5 ||
- That self [the individual jiva] is indeed Brahman, as well as identified with the intellect, the Manas and the vital force, with the eyes and ears, with earth, water, air and the ether, with fire, and what is other than fire, with desire and the absence of desire, with anger and the absence of anger, with righteousness and unrighteousness, with everything—identified, as is well known, with this (what is perceived) and with that (what is inferred). As it does and acts, so it becomes; by doing good it becomes good, and by doing evil it becomes evil—it becomes virtious through good acts and vicious through evil acts. Others, however, say, ‘The self is identified with desire alone. What it desires, it resolves; what it resolves, it works out; and what it works out, it attains.’
and further in the commentary on this verse...
...Similarly, being identified with the body and organs, the self, on seeing something to be attained, forms the false notion that it has got this one, and has to get that one, and setting its heart on that, becomes identified with desire. When on seeing evil in that thing its longing for it ceases, and the mind becomes serene, pure and calm, then it becomes identified with the absence of desire. Likewise, when that desire is somehow frustrated, it takes the form of anger, and the self becomes identified with anger. When that anger is appeased by some means, and the mind becomes serene and peaceful, it is called the absence of anger; the self becomes identified with that. Thus the self, becoming identified with desire and anger as well as with the absence of them, becomes identified with righteousness and unrighteousness, for without desire, anger, etc. the tendency to righteousness and so forth cannot arise. Witness the Smṛti: ‘Whatever action a man does, is the outcome of desire’ (M. II. 4).
Being identified with righteousness and unrighteousness it becomes identified with everything. Everything is the effect of righteousness and unrighteousness: whatever is differentiated is the result of these two. The self, on attaining it, becomes identified with that. In short, identified, as is well known, with this, i.e. with objects that are perceived, and therefore with that. ‘That’ refers to imperceptible objects that are indicated only by their perceptible effects. The mind has an infinite number of thoughts, which cannot be definitely specified; they are known at particular moments through their effects, which lead us to infer that this or that particular thought is in one’s mind. Through that perceptible effect—which marks the identification of the self with ‘this’ or the perceptible—its remote or internal activity is indicated, and it is therefore designated as identified at present with ‘that’ or the imperceptible. To put it briefly, as it habitually does and acts, so it becomes. ‘Doing’ refers to prescribed conduct as indicated, for instance, by injunctions and prohibitions, while ‘action' is not so prescribed; this is the distinction between them. By doing good it becomes good: This amplifies the idea of ‘As it does,’ and by doing evil it becomes evil, the idea of ‘As it acts.’
The use of a suffix denoting habit (in four words of the text) may lead to a notion that the identification with good and evil actions consists in intense association with them, not in merely doing them. To remove this it is said, it becomes virtuous through good acts and vicious through evil acts. The identification comes of merely doing good and evil acts, and does not require habitual performance. This last only intensifies the identification; this is the difference. The long and short of it is, that doing good and bad deeds under the impulse of desire, anger, etc., is the cause of the Ātman's identification with everything, its undergoing transmigration and passing from one body to another; for, impelled by this, the self takes one body after another. Therefore good and bad deeds are the cause of its transmigratory existence. Scriptural injunctions and prohibitions are directed to this. Herein lies the utility of the scriptures.
Others, other authorities on bondage and liberation, however, say: It is true that good and bad deeds prompted by desire etc. are the cause of a man's taking a body; still it is under the influence of desire that he accumulates these deeds. When desire is gone, work, although present, does not lead to the accumulation of merit or demerit. Even if he goes on doing good and bad deeds, these, bereft of the desire, produce no results; therefore desire is the root of transmigratory existence. As the Muṇḍaka Upaniṣad says, ‘He who longs for objects of desire, making much of them, is born along with those desires in places where he will realise them’ (III. ii. 2). Therefore the self is identified with desire alone. Its identification with other things, although it may be present, does not produce any results; hence the text emphatically says, ‘Identified with desire alone.’ Being identified with desire, what it desires, it resolves. That desire manifests itself as the slightest longing for a particular object, and, if unchecked, takes a more definite shape and becomes resolve. Resolve is determination, which is followed by action. What it resolves as a result of the desire, it works out by doing the kind of work that is calculated to procure the objects resolved upon. And what it works out, it attains, i.e. its results. Therefore desire is the only cause of its identification with everything as well as of undergoing transmigration.
तदेष श्लोको भवति ।
तदेव सक्तः सह कर्मणैति
लिङ्गं मनो यत्र निषक्तमस्य ।
प्राप्यान्तं कर्मणस्तस्य यत्किञ्चेह करोत्ययम् ।
तस्माल्लोकात्पुनरैत्यस्मै लोकाय कर्मणे ॥
इति नु कामयमानः; अथाकामयमानः—योऽकामो
निष्काम आप्तकाम आत्मकामो न तस्य प्राणा उत्क्रामन्ति,
ब्रह्मैव सन्ब्रह्माप्येति ॥ ६ ॥
tadeṣa śloko bhavati |
tadeva saktaḥ saha karmaṇaiti
liṅgaṃ mano yatra niṣaktamasya |
prāpyāntaṃ karmaṇastasya yatkiñceha karotyayam |
tasmāllokātpunaraityasmai lokāya karmaṇe ||
iti nu kāmayamānaḥ; athākāmayamānaḥ—yo'kāmo
niṣkāma āptakāma ātmakāmo na tasya prāṇā utkrāmanti,
brahmaiva sanbrahmāpyeti || 6 ||
6. Regarding this there is the following verse: ‘Being attached, he, together with the work, attains that result to which his subtle body or mind is attached. Exhausting the results of whatever work he did in this life, he returns from that world to this for (fresh) work.’ Thus does the man who desires (transmigrate). But the man who does not desire (never transmigrates). Of him who is without desires, who is free from desires, the objects of whose desire have been attained, and to whom all objects of desire are but the Self—the organs do not depart. Being but Brahman, he is merged in Brahman.
Regarding this subject there is also the following verse: Being attached, i.e. with his desire for it roused, he, the man who transmigrates, together with the work that he did with attachment to its result, attains that result to which his subtle body or mind is firmly attached, i.e. for which it yearns, since he did the work out of a desire for that.—The mind is called the subtle body, Liṅga, because it is the principal part of the latter; or the word ‘Liṅga' may mean a sign, that which indicates the self.—Therefore, only on account of this attachment of his mind, he attains the result through that action. This proves that desire is the root of transmigratory existence. Hence a knower of Brahman who has rooted out his desires may work, but it will produce no (baneful) result; for the Śruti says, ‘For one who has completely atta ìned the objects of his desire and realised the Self, all desires dissolve in this very life’ (Mu. III. ii. 2).
Further, exhausting the results of work—what kind of work?—whatever work he did in this life, by experiencing them, he returns from that world to this for work, for work holds the foremost place in this world. Hence the text says, ‘For work,’ i.e. to work again. After working again, he, owing to attachment to results, again goes to the next world, and so on. Thus does the man who desires transmigrate. Since ît is this man of desire that transmigrates thus, therefore the man who does not desire, does not transmigrate anywhere.
Brahma Sutras 2.1.34 (Chapter 2, Section 1, Adhikarana XII here - https://www.wisdomlib.org/hinduism/book/brahma-sutras):
वैषम्यनैर्घृण्ये न, सापेक्षत्वात्, तथा हि दर्शयति ॥ ३४ ॥
vaiṣamyanairghṛṇye na, sāpekṣatvāt,
tathā hi darśayati || 34 ||
aiṣamyanairghṛṇye—Partiality and cruelty; na—not; sāpekṣatvāt—on account of Its taking into consideration (other reasons); tathā—so; hi—because; darśayati—declares.
- Partiality and cruelty cannot (be attributed to Brahman) on account of Its taking into consideration (other reasons in that matter), because (the scripture) declares (it to be) so.
Some are created poor, some rich; hence the Lord is partial to some. He is cruel, inasmuch as He makes people suffer. To such an objection this Sutra replies that the Lord cannot be accused of partiality and cruelty, because He dispenses according to the merit and demerit of the individual soul. The scripture declares to that effect, “A man becomes good by good work, bad by bad work” (Brih. 3. 2. 18). But this does not contradict the independence of the Lord, even as the king’s status is not compromised by his giving presents to his servants according to their action. Just as rain helps different seeds to sprout, each according to its nature, so God is the general efficient cause in bringing the latent tendencies of each individual to fruition. Hence he is neither partial nor cruel.
Brahma-Sutra 2.1.35: Sanskrit text and English translation.
न कर्माविभागादिति चेत्, न, अनादित्वात् ॥ ३५ ॥
na karmāvibhāgāditi cet, na, anāditvāt || 35 ||
na—not; karmāvibhāgāt—for want of distinction in work; iti cet—if it be said; na—no; anāditvāt—because of (the world) being without a beginning.
- If it be said (that is) not (possible) for want of any distinction in work (before creation), (we say) no, because of (the world) being without a beginning.
Since before the first creation the individual soul cannot possibly have had a previous existence, whence comes the difference in the condition of beings in that first creation, unless the Lord has caused it out of His partiality? This objection is answered by the Sutra, which says that creation is without a beginning and the question of first creation cannot arise. It is like a seed and its sprout. So the individual souls have always had a previous existence aöd done good or bad deeds in accordance with which their lot in a subsequent creation is ordained by the Lord.
Brahma-Sutra 2.1.36: Sanskrit text and English translation.
उपपद्यते चाप्युपलभ्यते च ॥ ३६ ॥
upapadyate cāpyupalabhyate ca || 36 ||
upapadyate—Is reasonable; ca—and; api—and; upalabhyate—is seen; ca—also.
- And (that the world is without a beginning) is reasonable and is also seen (from the scriptures).
Reason tells us that creation must be without a beginning. For if the world did not exist in a potential state in the form of Samskaras (impressions), then an absolutely non-existing thing would be produced at creation. In that case even liberated souls might be reborn. Moreover people would be enjoying or suffering without having done anything to deserve it—an instance of an effect without a cause, which is absurd. It cannot be attributed to primeval ignorance, which, being one, requires the diversity of individual past work to produce varied results. The scriptures also posit the existence of the world in former cycles in texts like “The Lord devised the sun and moon as before” (Rig-Veda 10. 190. 3).
So partiality and cruelty cannot be imputed to the Lord.