It depends.
For example, in New South Wales, in Australia, one of my aunts (still living, but born before 1920) has been married three times, two divorces. I will disguise the SURNAMES she used, but .... here goes :
Let's say she was born Dorothy DOT.
First marriage was to Mr DASH. She divorced him, he had deserted her. No children. She reverted to DOT, as per electoral rolls, however
WHEN she next married, she had been cohabiting with Mr CITIZEN and they had 2 children together before they married. And when they then married she provided the clergyman with her details as Dorothy CITIZEN, formerly DASH nee DOT, and she signed as Dorothy Citizen... Two more children and all four births were registered by Mr CITIZEN at the time of these births, so they have always used that surname.
Mr Citizen left when the youngest of the four was 14.
The couple divorced, Dorothy commencing the legal proceedings. (This is prior to the changes to divorce laws in Australia in the 1970s that brought in "no fault divorce") The divorce was listed as CITIZEN v CITIZEN in the NSW Supreme Court, and the court papers have been archived and are available to public access at the NSW State Archives.
The file shows Dorothy as Dorothy Dot, formerly Citizen, formerly Dash, nee DOT, so she had reverted back to her nee name after that desertion and while waiting for the divorce to come through.
Dorothy next cohabitated with a Mr CITYSLICKER .... and when he died she moved in with one of her adult daughters (born CITIZEN, married Mr SMITH) and she then phoned me to say "oops, sorry, but next time you send me letter/card/parcel, please address it to Mrs CITIZEN, not to Mrs Cityslicker .... I have reverted to daughter's maiden name ! "). So she is currently Dorothy CITIZEN, even though her daughter does not use that surname and has not used it for decades...
OOPS, ADD (rellies following my threads say I need to add) that Dorothy had married Mr Cityslicker in a pallative care hospital several weeks before he died in that hospital.
In NSW it is still quite legal to become known by any name, so long as you are not attempting to deceive or be fraudulent etc ...
As to how those marriages would be indexed? Well in NSW BDM the marriage index is NOT available for public scrutiny for the first 50 years .... but .... one of her brothers is a retired NSW BDM senior officer, and another of her relatives is a retired CofE minister.
So, I have phoned both of these relatives. Yes, indexing ... each of the marriages can be indexed several times, under each surname found at the heading for her family name/former names and same for her husband ... and Yes, the officiating clergy or BDM officiating deputy registrar would have had no difficulties with handling all those surnames, they would only need Dorothy to show the NSW Supreme Court Decrees Absolute for those two marriages. It is the person who is marrying, they are entitled to be known by any name, so long as they are not deceiving etc ...
I have a male relative who changed his surname to one he selected at random. He married under that surname ...
and his death is registered under that surname. His parents surnames are shown on the NSW marriage cert and of course, no explanation was needed to be recorded on that registration.
JM EDIT to add info about Dorothy's marriage to Mr Cityslicker...