Hi all. Just my two cents here. I am new to iPhone. I've had a 5s for about a week (after 4 years of Android) and during the first days this was not an issue (and I use A LOT of screen rotation constantly due to the smaller screen), but ever since yesterday I have stopped closing the apps from the multitasking area (which were a habit of mine from the Android era) in the belief that with iOS it is not necessary (nor is it with Android). So today this bug shows up, my screen is rotating everywhere one minute, but won't rotate at all the next, no matter where I try it. So I closed all the apps from the multitasking area (double press the home button) and the screen started rotating again.
I do not know what exactly does closing an app from the multitasking area mean to the apparently quite buggy OS, but if it indeed does free RAM then this would be similar to the reset via the lock and home button combination that other folks are here suggesting.
Long story short, closing all the apps from the multitasking area worked for me instantly.