Speculation about Why a female octopus dies after her eggs are hatched
Female octopuses die round about the time their eggs hatch.   She reproduces only once and puts her available energy into generating and caring for her eggs. She finds a den and lays her eggs there. After that she does not eat and spends her whole time caring for the eggs, cleaning them and aerating them. It is likely that octopi have evolved mechanisms enabling them to match the number of eggs they produce to their available energy. An octopus that produces too few eggs will lose reproductive fitness. She will survive for a time after her eggs hatch but will soon die in any case and she has fewer progeny than she could have had. An octopus which produces too many eggs will die before her eggs hatch or will not have the strength to care for them effectively. This will also reduce her reproductive fitness.
It is unlikely or impossible that octopi can balance the above precisely. Certainly the amount of energy that a female will need to defend her eggs from predators is impossible to predict as that depends on the predators.
- Perhaps female octopuses give chemical signals to their eggs to speed up or slow down their development. I imagine something along the lines of , “Hurry up babies, I’m getting weaker and I can’t look after you much longer.” I’m not suggesting that the mother octopus actually thinks that way, only that unconscious mechanisms may have evolved with that effect. This could be tested in aquaria if mother octopuses are encouraged to look after eggs there and the water round them is regularly analysed chemically.
- Perhaps young octopi are flexible in when they hatch. While its mother can defend a young octopus its best survival strategy is to stay in its egg shell and continue its development there protected by its mother. After its mother weakens the best survival strategy for the young octopus is to hatch so it can react to predators and to be dispersed in the plankton. The mother disperses the young and the young hatch. This could be tested in aquaria if eggs from one mother octopus are marked and moved to the den of another mother octopus where the eggs are slightly older or slightly younger. Scientists could check if the transferred eggs hatch with their biological siblings or with their foster siblings.
As stated above for the last month of her life a mother octopus does not eat, she does not leave her den except to defend her eggs from predators, she lives for her eggs and has no other purpose in life. Her instinct tells her how to look after them. The last thing a mother octopus does for her young when they are ready to hatch is to blow them through her siphon and disperse them. It is generally agreed that octopuses and other cephalopods are intelligent.  The intelligence of cephalopods is difficult to analyse as molluscs are different from vertebrates but octopuses are certainly comparable to dogs and cats and arguably are comparable to lower primates in intelligence. For an animal of that intelligence losing her eggs is likely to be a psychological shock. Even dogs understand when they have lost their master or mistress. First there is the excitment of blowing the eggs through the siphon, then she realises that she has lost everything that matters to her. When her eggs are gone she is weak, close to death and has nothing else to live for. Natural selection will ensure that she does what maximises the chances that her young will survive. She will not notice while she is blowing the eggs through her siphon that she is losing her eggs. Any mother octopus who notices that and decides to hold onto her eggs will reproduce less effectively than a mother who disperses them all. Natural selection will ensure that she does not notice what is happening till all her eggs are dispersed. Alternatively even if she notices that she is losing her eggs she will still intensly want to carry on dispersing them. Once all the eggs are dispersed natural selection stops affecting her. Whatever happens she cannot reproduce a second time. She is seriously weakened, in any case she cannot live longer than a few days or a week at most and she cannot evolve defences against the psychological shock of losing her eggs. That shock might kill her in hours even if she has the strength to live a few days.
The above looks like a poetic tragedy, it looks good for some type of story or romance but it happens to every female octopus anywhere in the world that reproduces successfully.