Guess what happened three days after the end of my 1 year warranty on my Nexus 7? Auto-rotate stopped working. Restart would reorient the screen to portrait, but the only way my Nexus 7 2013 (Lollipop 5.0.1) would flip to landscape was if an app forced it into landscape. Then it took a restart to get it back to portrait.
Researched online and started with downloading "Check My Android" app from the Play Store. ran the sensor diagnostic and found out sensors 1,5, and 7 were not functioning. This includes the accelerometer that reorients the screen. All indications were a hardware issue, out of warranty. I had seen the video of cracking open the back and placing a shim or tape over the ribbon cable, but decided to try everything I could before cracking open the back. And I found something simple that worked for me, and led me to believe this may not be a hardware issue at all.
The process that worked for me ...
1) Go into settings under Accessibility, and turn off auto-rotate
2) Power down and restart your Nexus,
3) Go back into settings under Accessibility, and turn auto-rotate back on
Magically, it is back to normal. I even immediately ran my sensor diagnostics and sensors 1, 5, and 7 are all back online. Hope it prevents someone else from cracking open their Nexus too.