Assalamu alaykum
Narrated 'Umar bin Al-Khattab:
I heard Allah's Apostle saying, "The reward of deeds depends upon the intentions and every person will get the reward according to what he has intended. So whoever emigrated for worldly benefits or for a woman to marry, his emigration was for what he emigrated for."
In other words if you do such and such a thing for Allah's pleasure then He will be pleased with you and you shall maximize the rewards gained. However if do not have the correct niyyah then you will not gain rewards for it. It is also a way to show obedience in front of Allah and is a check in preventing you from pleasing people instead of Allah. The first from our ummah to be thrown into the Hellfire will be a Mujahid who fought in the path of Allah so that others would rate him and think highly of him, the next will be a Scholar who conveyed the message to show off, then someone who paid sadaqah so others will respect him - this is why your niyyah is important and you must do everything for Allah's pleasure.
Allah subhana watala is not in need of us at all. Even if the whole of creation turned to Him and worshiped Him - He would not gain an atoms worth in His kingdom, and similarly if all of creation turned away from Him and went astray - He would not lose an atoms weight worth from His kingdom.