How can we know if our dua is delayed or rejected?
Every prayer you make is an act of worship, and in response to it God arranges things more favorably for you. There are no wasted prayers. But God’s response to our prayers is a matter of the Unseen world that is hidden away from us. When it comes to what He does in response to our prayers, most of the time we cannot be sure. God tells us in the Quran not to put our hopes in the worldly life and to not be attached to it, for this reason the proper attitude of a Muslim should be to pray for general things rather than specific things. You might pray to be the top student of your class, but another person might be praying just as hard for it, or God may have a plan for them that requires them to be the top student, so praying for something too specific often sets you up for disappointment.
A pious Muslim can pray for things they desire, but they should always acknowledge that God may have a different plan for them. We may desire to marry a specific person and pray for that, but God does not promise us that He will answer such prayers. He may if He wants, and He may not if He does not want. True submission to God means to submit to His decrees about us rather than making demands and telling Him how He should be managing our affairs for us. God knows us better than we know ourselves and knows what we best need, therefore we should not pray like masters making decrees to a servant to do things for us, we should instead pray with full knowledge that God always knows better. Ibn al-Jawzi writes:
The true servant of God is the one who accepts whatever the Creator decrees. If he asks of Him and He answers, he considers that a privilege granted by Him, and if he is denied, he considers that an act of the Master doing what He wills toward His subjects, so that there is no complaint in his heart toward his condition.