Stocks are broadly gaining on optimism about government policy and the economy.