The brief answer is that when the purpose of this worship is to fulfill the needs of Allah and by obeying Him we give some benefit to Him, then the question arises that Allah is unlimited and away from all defects and needs; then what is the need for our worship, but the purpose of worshipping Him would be to elevate ourselves, then the worship would be a means to elevate ourselves and for goodness and it will a favor and guidance from Allah to make us reach perfection through worship.
The detailed answer is as follows: Worship, supplication and whatever deed is performed for pleasing Allah, more or less it has the effect on the person and society also. In fact these are the highest training and ethics in the school of Islam because: 1- The worship of Allah creates a sense of thankfulness, respect and honor. To realize the value of the source from where man gets the valuable divine blessings is a sign that the person was deserving of them.
2- The worship of Allah elevates the soul of man. What else can be more elevating that he gets connected to the total perfection and that is Allah, and for the duties of worship and the affairs of this life we ask help from the unending and unlimited power and acquire that much capability that we can communicate with Him.
These benefits are present in all the worship acts, which are performed correctly, and other worship acts like Prayers, Fasting and Hajj etc have their own benefits and effects.
Reference: Philosophy of the Islamic Laws by Ayatullah Makarem Shirazi