Depending on the country and length of your stay, you may need a visa or a residence permit, especially outside the EU. Find out about the requirements in advance. Unfortunately, this often takes several months, so be sure to start well in advance and submit your application to the appropriate diplomatic mission in your target country.