I’ve noticed this happens fairly often when trying to log into portal.microsoftonline.com. Firefox and Chrome will throw an error about a redirect loop. Seems like a conspiracy, Microsoft, because this never happens to me in IE!
Workaround
Use an Incognito tab (Chrome) or a Private Window (Firefox) and save yourself from having to wipe all history and cookies known to man or having to restart your browser. This solves the issue for me 100% of the time.
I would recommend viewing portal.microsoftonline.com in a privacy mode window regardless. There have been a handful of times when the session timeout did not occur, and my account was still logged in even after re-opening the browser. Using Privacy Mode will ensure you are logged out as soon as the browser is closed.