An exchange is normally undertaken in the third year of study as part of your chosen degree programme. Usually, you apply during your second year, study abroad during your third year and return to Edinburgh for your fourth year. The Edinburgh University website gives lots of information about exchange opportunities.