Razor-thin margins and possible legal challenges mean America’s next president might not be known for some time