You correctly note that God
never does injustice to anyone but still we pray to God for our interest, even when such a prayer entails injustice. This is however not a problem with prayer but rather our flawed application of it. Of course God will not grant a prayer for an unjust action; such a wish is, I think, probably to be counted as a sin.
But of course these are not the only kinds of prayers. The more interesting question is, why pray at all? After all, God has perfect knowledge, and God's will is immutable, so if you are in the kind of trouble that God would help you with, God is already knows about it and is already either going to help you or not.
From Aquinas's Summa Theologica, Part 2.2, Question 83, On Prayer, Article 2, Whether it is becoming to pray?:
Objection 1. It would seem that it is unbecoming to pray. Prayer seems to be necessary in order that we may make our needs known to the person to whom we pray. But according to Matthew 6:32, "Your Father knoweth that you have need of all these things." Therefore it is not becoming to pray to God.
Reply to Objection 1. We need to pray to God, not in order to make known to Him our needs or desires but that we ourselves may be reminded of the necessity of having recourse to God's help in these matters.
There you have it. We pray for ourselves, to remember our place in the world. That's Catholic dogma, at least, but the logic holds true for any religion with a similar conception of God as all-powerful, all-knowing, and all-good.
Poverty and the Bible
You end asking why the Bible says that God helps the poor when people can achieve success through hard work. However it is not the case that our fortunes are entirely under our control; this is a basic result of living in a world with other people and changing conditions. Our success is highly determined by the place in and kind of society we are born in, general economic trends, natural disasters, etc.
Humans have free will, so I think we can safely assume that economic trends are, generally, not the kind of thing God would interfere with. Similarly society is shaped by humans to be unequal. That's on us, not God. That leaves natural disasters and the like. For that, see this excellent summary, and, if you still have questions,---and it's a fair bet that you will---ask them here!