First, clean up any mess you've made so far (undo changes, installs, etc.)
1.
Download this (I'm assuming you're on Windows)
2. Go into sdk folder and run sdk manager .exe
3. Checkmark "sdk platform tools" and "google usb driver", then install them, then close the sdk manager
4. Make sure ;C:\<path_to_sdk>\platform-tools is at the end of your "Path". (Right-click "This PC" in File Explorer > Properties > Advanced system settings > Environment Variables > Scroll Down to "Path" > Edit)
5. Save it, then open up a command line
6. Enable USB debugging on your Nexus device
7. Plug in your device. If the tablet asks you to trust the computer press Yes/Ok
8. Enter "adb devices" without quotes. It should list a "device".
9. Enter "fastboot oem unlock" if your bootloader is locked
10. Navigate to the system image folder containing the flash-all.bat file through the command line
11. Enter "flash-all.bat"
12. After it's rebooted and everything you can run "fastboot oem lock" to lock it up again (for security)
Hopefully I didn't miss anything...