The legal discussion hinges on the question whether the concept of copyright exhaustion applies to software. (The linked article also discusses the Court of Justice of the European Union ruling mentioned below in the EU part of this answer.)
Copyright exhaustion, in simple terms, allows certain uses (like the ones in your scenarios) of copyrighted (books) or patented (e.g. devices) items for which the copyright or patent holder has the right to first sale. If and when that principle applies, the original seller cannot control further sales or other uses of that particular specimen. Their copyright is "exhausted" with the first sale.
Situation in India
I want to emphasize that I have exactly zero experience regarding India in any way. All I did was that I went to the google.
It appears that the Indian Supreme Court recently ruled in Engineering Analysis Centre for Excellence Pvt. Ltd. v. CIT that the typical EULAs are valid. In particular, copyright exhaustion does not apply and the EULA can restrict re-selling and similar actions.
The case is discussed in this article, including relevant quotes.
This would make everything illegal which is forbidden by an EULA. As I read the EULA, creating a backup copy is allowed, as is restoring Windows from it, obviously; whether that has to happen on the same computer is unclear to me and may depend on the license type (OEM vs. standalone), although I have two remarks:
- Microsoft is the copyright owner; if they provide you with a license (for example because you called them after you re-installed Windows from a backup copy, and the internet license process didn't work) without you making false claims it is their prerogative. You are good.
- What constitutes a different computer? The SSD? The case? The mouse? We do have a case of the Ship of Theseus, or here for a funnier take: How much can you change before it becomes a different machine? The answer: Call Microsoft and find out.
Situation in the EU
The situation in the EU is fundamentally different from the one depicted with a misguided metaphor in the accepted answer.
In Europe, all of your scenarios are legal.
In July 2012, the European Court of Justice ruled in favor of the company usedSoft who is a license reseller.
(I'm writing this text on a machine with a Windows license that cost me, together with a Microsoft Office Professional license, 30 Euros, from this store.)
The title of the Court's press release couldn't be clearer:
An author of software cannot oppose the resale of his ‘used’ licences allowing the
use of his programs downloaded from the internet
Not only can you re-install the software, provided it is the only installation, on the same or a different computer; you can even sell it. You can even sell OEM and bulk licenses.
The full text of the decision can be found here. The court stressed that it doesn't make a difference whether the software was originally provided on a physical carrier like a DVD or as a download. Crucially, the seller is obligated to continue providing downloads and updates for the re-sold licensed software as if it were still owned by the first buyer. There is no legal difference between software provided on a physical medium or as a download. To quote the decision:
80 Since the copyright holder cannot object to the resale of a copy of a computer program for which that rightholder’s distribution right is exhausted under Article 4(2) of Directive 2009/24, it must be concluded that a second acquirer of that copy and any subsequent acquirer are ‘lawful acquirers’ of it within the meaning of Article 5(1) of Directive 2009/24.
81 Consequently, in the event of a resale of the copy of the computer program by the first acquirer, the new acquirer will be able, in accordance with Article 5(1) of Directive 2009/24, to download onto his computer the copy sold to him by the first acquirer. Such a download must be regarded as a reproduction of a computer program that is necessary to enable the new acquirer to use the program in accordance with its intended purpose.
The court also examines the problem of how to prevent abuse of this permission for online copies (as opposed to physical media) and finds no substantial obstacles here.
"79 As Oracle rightly observes, ascertaining whether such a copy has been made unusable may prove difficult. However, a copyright holder who distributes copies of a computer program on a material medium such as a CD‑ROM or DVD is faced with the same problem, since it is only with great difficulty that he can make sure that the original acquirer has not made copies of the program which he will continue to use after selling his material medium. To solve that problem, it is permissible for the distributor — whether ‘classic’ or ‘digital’ — to make use of technical protective measures such as product keys.
It seems noteworthy to me that the general question of how to prevent illegal copies is only loosely related to the question of reselling anyway. Even if it were illegal to resell, the seller's problem with illegal copies would not disappear. (It might be somewhat easier to enforce by "dongling" it to a specific hardware and not allow any re-installation whatsoever, but mainstream software producers don't appear to do that, generally.)
Lastly it is noteworthy that the original seller may strong-arm the original buyer into signing an EULA that expressly forbids reselling; those restrictions are simply null and void in the EU.1
1 The German EULA of Microsoft Windows does not forbid reselling. The EULA for MS Office has restrictions concerning transfer to third parties in point 3 but notes that those are not applicable if the software was bought in the EU or EFTA and the transfer is inside that region.