In the sentence, 「私の家の庭には小さな池があります」 the sound 「には」 appears twice in a row. When listening but without any writing to inform interpretation, how will I know whether to interpret the first 「には」 sound as the kanji 「 庭」 or as the hiragana 「には」?
In this case, you can distinguish using the pitch accent. 庭 is pronounced like にわ【LH】 (i.e., 平板 accent) and には pronounced in isolation is にわ【HL】. 庭には is pronounced as にわにわ【LHHL】. (には within a sentence is pronounced like には【LL】 after a non-平板 word.)
When two words are pronounced exactly the same way including the pitch accent, the context is the only clue. If you can distinguish night and knight, too and two, or their and there in English conversations, the same method works in Japanese, too.