Only works when the app is open and your phones unlocked. Should be automatically set up to do it. If not touch the pokeball, and in the top right will be a settings button which will open a menu. Be a box to tick in there.
If you tick the battery saver one, and then turn your phone upside down, it'll go into a "sleep" mode which should still vibrate when a Pokemons near you.