To switch between real and demo accounts in MT5, you need to go to the 'File' menu, select 'Login to Trade Account', and enter the login credentials for the real account or demo account.