The basis for this is the way a regex engine typically goes about making a match. (This can be modified by your program intervening between matches but, expecially in a case like this, that is a LOT more work than it is worth).
Let's take the phrase in the original post:
how to write this
and a hypothetical patter that would match 2 successive "words"
\w+\s+\w+
So far, this would be (roughly) the situation used by the OP to approach this problem using a regex.
The regex engine maintains 2 pointers: one into the current point in the text and the other into the current place within the pattern and both begin at the start of their respective entities.
That means that, when the regex engine tries to match a character against the initial '\w+' of the pattern, the "h" of "how" is the character being checked. In this case it will "match" and the regex engine will advance the text pointer to the next character - the "o". It will also move to the next part of the pattern which, because of the '+' quantifier, will still be the initial '\w+'.
Again the "o" will match and the above process continues until the text pointer points to the space and the pattern pointer points (still) at the '\w+'. In this case the character does NOT match the pattern but because the '\w+' has matched "1 or more" characters, this time it is the pattern pointer that moves on to the '\s+' which DOES match the space.
I'll skip over the next but as it is really just a repeat of the above processing to the point where the second '\w+' in the pattern is matched against the "o" of "to" and the text pointer is advanced to the following space character. This does not match the '\w+' but, as before, it has already satisfied it quantifier and so the pattern pointer moves to the next item: the end of the pattern which results in the complete pattern "matching" the text "how to".
If/When the regex engine is asked to repeat the match (the "global" flag is set or the "match all" operation is requested or whatever the case may be for the regex engine) it picks up from where it left off as far as the text is concerned, but resets the pointer back to the start of the pattern. this means that it will try to match the space between the "to" and "write" against the first '\w+' of the pattern - and it will fail. Because there are no alternative paths within the pattern that can be tried, the regex engine will declare a "failure" for this match and step forward the text pointer by 1 character and then tries again. Therefore the next character to be checked is the "w"of "write" which starts the next match going.
I'll stop at this point because we have gone far enough to see the problem with the OPs question and required output. As the OP wanted, we have matched the first 2 words "how to". However the OP then wanted us to back up one "word" and start the next match there to give the "to write" result. As Michael pointed out, "Once a value is consumed in a match it does not participate in another match". We can see this in the above process explanation: the "to" was "consumed" in the first match and the text pointer is already pointing PAST this point in the text when it tries to start the next match.
As I said at the start, depending on the regex engine, there can be ways to "manipulate" the process by setting the text pointer to be used at the start of the matching process. However, this involves intervention by your program between matches and also having the program work out where the new starting point should be. By the time you've done all that, then you might as well have not used the regex in the first place,,,,
I hope this is a bit more "...informative..."
Susan