Jim and Jane
“Avoir besoin de repos” is non-specific/indefinite “I need (some) rest.” No definite article, de remains unmodified, as there is no contraction or repetition with indefinite/partitive articles.
“Avoir besoin des crayons” is specific, not general ‘I have need of the crayons” (“J’ai besoin des crayons, qui sont sur la table”, for example). It is the contraction of ‘de les’ to des. Alternatively, I need (some) crayons - “J’ai besoin de crayons”.
Avoir besoin de = To need (French Expressions with avoir)
https://www.frenchtoday.com/blog/french-grammar/french-definite-article/