This article summarize the original article posted in Japanese at Jan. 4, 2015. Nexus 7 (2013) の画面が自動回転しなくなる問題（解決法？）
[Article in this blog]
A famous issue for Nexus 7 2nd [*1] is that auto-rotation suddenly stop working, though software setting is set properly. Additionally, almost all apps related to accelerometer or magnetometer ( such as "compass" or "fitness" apps) do not work properly at the same time. A possible reason is all sensors related to gyro are physically offline (Mostly, GPS and light sensor are survived).
According to previous (numerous) reports, connection of the certain flat cable is strongly related to the auto-rotation issue.
Most famous fix video is below:
Youtube: Nexus 7 2013 Auto Rotation Freeze (easy hw fix)
the technique works quite well. I tried it finally. But it takes some risks due to open the device.
I introduce a "moderate" technique for temporally fix the auto-rotation issue below.
The method is quite simple, do not need to open the case. Just push one spot after shutdown.
The area is just above the connector of the flat cable. Push gently, then boot your Nexus 7. That's it.
It's too easy, so it seems to be doubtful at all, although it works well.
If your device (around the connector) is not so much damaged, your Nexus 7 temporarily recover the function of auto-rotation.
Unfortunately, this technique is not for permanent solution. It is safe way in comparison to the technique with open the cover.
[added: Nov. 20 2015]
If you need more detailed explanation, see the "Best answer" of this thread
on the Nexus Help Forum
[*1] Device information：
Device: Nexus 7 2nd generation (2013)
OS: Android 4.4.4 (KTU84P) when original article posted, Android 6.0 (MRA58V) now.