A 301 redirect also known as permanent redirect should be put in place to permanently redirect a page.
A 302 redirect also known as temporary redirect should be put in place if you want to redirect your site visitors into another webpage but you plan to bring the redirected page back after sometime.
As per moz, 301 (Permanent Redirection) passes 90 to 99% link juice to redirected page from the current page. 302 refers temporary redirection, it never passes link value to redirected page from the current page.
Status 301 means that the page is moved permanently to a new location. The user or browser should not attempt to request the original location but use the new location from now on
Status 302 means that the page is temporarily located somewhere else, and the user or browser should continue requesting the original url.
When a search engine spider finds 301 status code, it understands that this webpage no longer exists, it searches for location header in response pick the new URL and replace the indexed URL with the new one and also transfer pagerank.
When a search engine spider finds 302 status for a webpage, it will only redirect temporarily to the new location and crawl both of the pages. The old webpage URL still exists in the search engine database and it always attempts to request the old location and crawl it.