GPS turns off when Android phone's display turns off while playing Pokemon Go
Solution 1:
Two steps to "fix" this, although I admit it's a little bit of a hassle:
Go to your android system settings, and change your display timeout to the longest you can find, usually either 10 minutes, 30 minutes or infinite, depending on your phone
In the settings menu of Pokemon GO, activate the "battery saving" checkbox.
In the battery savings mode, the app will detect if you turn your phone upside-down, and turn the screen black without actually turning it "off" in the sense of a locked screen. This way you should be able to toss it in your pocket without the GPS turning off, as your phone will still consider the app as actively using the screen.
At least this strategy works fine on my Galaxy S7. Just remember to check it within your max. display timeout time window so it won't actually lock the screen in you pocket.
Solution 2:
It's inherent to Android that GPS turns off when the screen's off as well, to save power. There are however multiple apps that will allow you to circumvent this limitation, such as Tasker and others.