Thanks for the question.
Though Mary is not God, and can't hear your thoughts by her own power (after all she is only human, albeit a glorified human being), she is, in God, who can hear your thoughts, so if God wants Mary to know your internal prayer, they are shared with her.
God shares His Divine Nature by grace to those he has adopted as His children, and since Mary is the pre-eminent example of this perfection, she has this gift to share in God's life in the most excellent way. Therefore she hears your prayers.
I pray my Rosary out loud and internally, and in both cases, I know that the prayers are getting to the Lord, and all those whom I am asking for intercession — especially Mary.
The same principle is true of all those saints who are in the Lord.