If your iPad is working normally, getting the screen to rotate into either landscape or ... of the device starts working normally again. To reset all settings... Go to the "Settings" app.
Not only that, but you can lock your iPhone's screen in a particular rotation to ensure it doesn't change even if you happen to physically move the phone in your hand. Here's everything you need ...