Rule 1: 1. Agreement with the noun
The relative pronoun agrees with the noun before it in gender and number, like an adjective, and like an adjective it can only follow a definite noun. The masculine plural اَلَّذِينَ and the feminine plurals are used for persons; a plural of things, being treated as feminine singular, takes اَلَّتِي. Only the dual shows case: اَللَّذَانِ / اَللَّتَانِ after a nominative noun, اَللَّذَيْنِ / اَللَّتَيْنِ after a genitive or accusative.
وَصَلَ التَّاجِرُ الَّذِي يَسْتَوْرِدُ الشَّايَ مِنَ الْهِنْدِ.
waṣala t-tājiru lladhī yastawridu sh-shāya mina l-hindi
The merchant who imports tea from India has arrived.
هٰذِهِ هِيَ الشَّرِكَةُ الَّتِي تُصَدِّرُ التَّمْرَ.
hādhihi hiya sh-sharikatu llatī tuṣaddiru t-tamra
This is the company that exports dates.
اَلتَّاجِرَانِ اللَّذَانِ وَصَلَا أَمْسِ مِنْ أَعْضَاءِ الْوَفْدِ.
at-tājirāni lladhāni waṣalā amsi min aʿḍāʾi l-wafdi
The two merchants who arrived yesterday are members of the delegation.
Nominative dual after a nominative noun.
اِجْتَمَعَ الْوَزِيرُ بِالتَّاجِرَيْنِ اللَّذَيْنِ وَصَلَا أَمْسِ.
ijtamaʿa l-wazīru bi-t-tājirayni lladhayni waṣalā amsi
The minister met the two merchants who arrived yesterday.
Oblique dual after a genitive noun.
زُرْنَا الشَّرِكَتَيْنِ اللَّتَيْنِ تَسْتَوْرِدَانِ الْقَمْحَ.
zurna sh-sharikatayni llatayni tastawridāni l-qamḥa
We visited the two companies that import wheat.
Feminine oblique dual after an accusative noun.
اَلنِّسَاءُ اللَّوَاتِي يَعْمَلْنَ فِي الْمَصْنَعِ يَصْنَعْنَ السَّجَاجِيدَ.
an-nisāʾu llawātī yaʿmalna fi l-maṣnaʿi yaṣnaʿna s-sajājīda
The women who work in the factory make the carpets.
اَلْبَضَائِعُ الَّتِي وَصَلَتْ أَمْسِ فِي الْمَخْزَنِ.
al-baḍāʾiʿu llatī waṣalat amsi fi l-makhzani
The goods that arrived yesterday are in the storeroom.
Plural of things: feminine singular اَلَّتِي and verb.