There are many different factors that have led to migration into and out of the UK over the past few centuries.
One of the major causes of emmigration from the UK to North America, especially in the seventeenth and eighteenth centuries, was the quest for religious freedom. In this period, people who were not members of the Church of England suffered many civic disabilities, including being prevented from holding public offices, attending universities, or establishing churches. The other major cause of emmigration was economic opportunity; many people saw North America, Australia, India, and the East Indies as places that they could find economic opportunity, without the obstacle of Britain's rigid class system.
In more recent times, immigrants from poorer countries in the European Union and Commonwealth countries have moved to the UK for the opportunity for economic advancement, education, and the superior medical care available in a wealthy country. Refugees from war torn countries and oppressive regimes have also moved to the UK for the safety and rule of law it affords. Pensioners, however, often retire from the UK to warmer, sunnier climates with a lower cost of living.