In order to receive notifications about nearby Pokemon and have steps tracked for egg counting, you must have the screen on and the app in the foreground.
You may use Battery Saver Mode (In Settings) willto darken your screen when you turnand avoid looking at your phone. When the phone downwardis turned upside-down (like putting it inin your pocket) and notify you when a pokemon is near and count your steps, for hatching eggs.
(Information is directly found inexample), the Help section ofscreen will darken but the App)app will continue running in the foreground.