Redownloading a game on new ps4
Yes, if you log into the same PSN account you purchased the game with on your new PS4, you can re-download any purchases you previously made on that account. Digital purchases are only bound to accounts and not to the physical hardware. This also means, that when you remove your PSN account from the console before you sell it, the new owner won't have access to any of the games.
Also, save files for games that aren't online multiplayer are stored on the console, so if you want to continue your game progress on the new console, you need to back them up either online with PS Plus cloud storage or on a USB stick.