Her frame of mind at the time of her death is quite unclear. What is known that in the aftermath of the consolidation of the Second Triumvirate, Mark Anthony, Lepidus, and Octavian Caesar, the land of the Empire was divided between these three men, with Octavian retaining Italy, Hispania, and Gaul, Lepidus in Africa, and Mark Anthony in Egypt and the Middle East. This put Mark Anthony at a tremendous advantage because Egypt was the primary producer of grain in the Empire. The middle east was also a vast epicenter of wealth. Mark Anthony then tried to use his new-found economic prowess as a weapon, to starve Octavian into submission (Lepidus was quickly becoming a non-issue at this point), Octavian couldn't move because Anthony still held considerable populist support, more so than Octavian.
It was during this time in Egypt that Anthony became acquainted with Cleopatra. The two became enamoured with each other. Anthony started appearing in Egyptian garb instead of Roman garb. They kept each others companionship constantly.
Octavian attempted to reconcile his differences with Anthony by sending his sister, Octavia, who was also Mark Anthony's legal wife. Whether Octavian was attempting a sincere attempt of reconcilliation or he knew what Anthony's actions would be is unknown. Anthony snubbed his wife, not even permitting her in his presence, he turned her away. This slight gave Octavian the ammo he needed to wage a popular war against Anthony. The forces of Octavian and Anthony met at Actium where Octavian won a decisive naval victory, despite Anthony being his superior as a general. Anthony and Cleopatra fled back to Alexandria, and barricaded themselves in their palace, which was being beseiged by Octavian's forces. Octavian gave Cleopatra an ultimatum; surrender Anthony, and she and her rule would be spared. She had Anthony presented with a fabricated suicide note and Anthony, thinking she killed herself, commited suicide. The gates were open to Octavian's forces, and Octavian met with Cleopatra, asking that she and her children accompany him back to Rome. However, that would be her last act as queen; she let an asp bite her, and she died next to the body of Anthony.
Another story states that Anthony stabbed himself, but didn't die. When his armies desert him and join with Octavian, he cries out that Cleopatra has betrayed him. She, fearing his wrath, locks herself in her monument with only her two handmaidens and sends messengers to Antony that she is dead. Believing them, Antony stabs himself in the belly with his sword, and lies on his couch to die. Instead, the blood flow stops, and he begs any and all to finish him off.
Another messenger comes from Cleopatra with instructions to bear him to her, and he, rejoicing that Cleopatra is still alive, consents. She won't open the door, but tosses ropes out of a window. After Antony is securely trussed up, she and her handmaidens haul him up into the monument. This nearly finishes him off. After dragging him in through the window, they lay him on a couch. Cleopatra tears off her clothes and covers him with them. She raves and cries, beats her breasts and engages in self-mutilation. Antony tells her to calm down, asks for a glass of wine, and dies upon finishing it.
Octavian would take her children, have her son with Julius Caesar murdered ("There can only be one Caesar" in his words) and send the rest of them to be raised by Octavia, his sister.
From here, Octavian would go on to clinch absolute power in Rome and rise to become its first emperor; Caesar Augustus.
Cleopatra was powerful due to her alliance with Julius Caesar. During the civil war between Julius Caesar and Pompey Magnus, Cleopatra had been in exile. Pompey had been defeated in Greece and fled to Egpyt for either Asylum or for support. The court of Ptolemy XIII, Cleopatra's 12 year old brother and her husband, had Pompey executed in an attempt to gain favor with Caesar. Caesar, however, took this action as a grevious insult to Rome, and supposedly broke down and wept when he discovered that Pompey had been executed. Caesar instead sided with Cleopatra, deposing her brother (who would drown in the Nile) and installing her as sole monarch of Egypt. Their alliance was cemented when Cleopatra bore a son with Caesar, and Cleopatra's Egpyt would exist as a client state until her death, when it became a province of the Empire.