Year-end optimism pushed stocks to a fifth-straight week of gains on Friday.