A small nation on the edge of South America is rewriting the rules of global energy and sovereignty while the giants watch in disbelief.