Although all Islamic laws are a result of the benefits or disadvantages and harms that back them, and they all have a particular reason behind each and every one of them, discovering the exact reason in detail for every one of them and knowing that this is all there is to it, is extremely difficult. The most we can do is give some general guidelines regarding these laws, and what we mean here by ‘general’ isn't that there aren't any exceptions either.
To get your answer, several points need to be considered:
1- Based on the true theory that Shia scholars and ulema believe in, the laws Allah (swt) legislates are all based on the benefits they entail or the harms and disadvantages they prevent, in other words, if something is made wajib, it is because of the one or many important or crucial benefits it entails, and if something is made mustahabb, it is because it entails non-crucial benefits. The same goes for haram and makruh acts; if something is haram, it means that it has one or several extremely bad and harmful outcomes, and if something is makruh, it shows that the bad things it entails aren't very severe or harmful. As for acts that neither have a dominating benefit nor a dominating harm are mubah (which means permissible). One thing that must be noted is that when we say benefit or harm, it has a vast meaning that covers more than just worldly ones; it has to do with all perspectives and existential dimensions of man.
2- Although the abovementioned principle that says Islamic laws follow the real benefits and harms certain actions entail is one accepted by all and is for sure, nevertheless, discovering exactly why and what reasons cause a ruling is extremely hard and challenging because:
Firstly: Such a task calls for a great deal of knowledge in many many different fields.
And Secondly: No matter how much man's knowledge develops, what he knows will be a drop in comparison to what remains unknown to him and he hasn’t discovered yet “…and you have not been given of knowledge except a little”[1].
Maybe the reason why our imams didn’t explain the reasons for these laws was because the scientific and scholarly status of the world back then totally differed from now and the people then wouldn’t understand anything that was being said to them, and this might have even led to a backfire, resulting in their dislike of the religion. Imam Ali (as) says: “People are the enemy of what they do not know.”[2] This led to the imams not engaging in such matters.
Add to that the fact that religion and its laws pursue the goal of us becoming good people and building ourselves both in spiritual matters and in knowledge, and to be free of bad knowledge and actions, and this goal is reachable through acting upon religion, even if we don’t know why religion has asked us to do certain things, the same way we listen to the doctor even though we might not know exactly why he has prescribed a certain drug and know that we will get better. The believers know that religious commands and laws come from individuals who are infallible and whose knowledge comes from above, making it flawless, therefore they are sure the goal of their creation is obtainable through acting upon these orders.
3- Although finding the exact reasons for Islamic laws is very difficult and taxing, it is possible to present some general guidelines regarding them. Of course generality in law-related matters differs from generality in philosophy; in philosophy if something is general it means that there are no exceptions, and that is not the case in law. What is meant by general guidelines here, is that they usually apply, but there also might be exceptions sometimes.[3]
Traveler’s Prayer:
One of the reasons for why the traveler’s prayer is shortened, is ease. Even if a person travels even with the best facilities it will still be tiring for him both mentally and physically and since worship needs to be in a way that is in compliance even with the individual’s mental status and not be tough on him so that he performs it with inclination, Allah (swt) has through His grace and mercy eased it upon him by shortening the prayer. The prophet of Islam (pbuh) says: “In order to honor my nation, my lord has given them a gift in which He hasn’t given to any other previous nations.” The prophet (pbuh) was asked what that gift was, he replied: “Not fasting and shortening the prayer during travel. Therefore, whosoever doesn’t act upon these two orders is like one who has turned down Allah's (swt) gift!”[4]
These are some of the reasons of Islamic laws, but can't be considered their complete causes and the total reason for their legislation. In other words, sometimes there may be cases in which although this same reason exists, yet the ruling doesn’t, and that is because hadiths like these are only disclosing a portion of the reason(s) for a ruling, not the exact and total cause and all of the reasons altogether.
Another reason for such rulings, is to test Allah's (swt) servants. When one believes in Allah and knows that He possesses never-ending wisdom and grace, he has to practice being loyal without any questioning, this is the meaning of true faith; who knows, there may be a reason or reasons behind the ruling that only He knows of? All we know is that this order is a wise one because it is coming from the All-Wise, making it the best thing we can do regarding that particular issue. Of course, this doesn’t mean that we can't refer to hadiths to try to discover some of the reasons behind them just for our own assurance and for our hearts to be at ease.