There is a trend in the software economy for tech people to switch jobs much more often than they did before. It gets ever more likely that at some point an employee of yours leaves to work with another company on a more interesting project or learn new skills. While some ten years ago this behavior would be considered the condemned job hopping, nowadays it is considered normal. The good thing is, ex-employees often decide to get back to the company they worked for. There is a term for them: Boomerang employees.
With the rising competition to find talent every day, not only you have to think of retaining people, but you must put a lot of effort on staying in good relations with people leaving your company. After all, there is a good chance that you will work with them again. Moreover, having them on board might be a better option than searching for new talent.
It is important to note the difference between re-hiring a person who was fired and a person who left by their own decision. Different considerations must be taken in each of the situations.
If the person was let go, rehiring them would be a good decision only if the reasons for parting were regarding technical or organizational skills. In such a case, the person might have acquired new skills in their intermediate job, which might be valuable for your organization. Interviewing them will show you if they advanced to fit your organization better. If it was cultural differences or behavioral mismatch, however, then rehire might not be the right choice. Change in culture is a much more difficult thing, thus the candidate might have not done anything in these terms. On the other hand, even if they changed, misbehavior is much harder to forget than lack of skills, so your team might not be ready to welcome them.
If parting was their own decision and you were in good terms, the ex-employee might be beneficial for a number of reasons: they could have a direct input with new skills they acquired; they would add fresh approaches to solving organizational tasks; returning of a person who left for a different, perceivably better place often raises the morale in the office and aid into improving the loyalty of the others. Besides these, often missed from considering are the high costs of ramping a new employee up, which your organization would save.