What goes behind the scenes when the product installer supported upgrades?

My team is building an auto update feature for one of our products and I tried to understand the concepts being upgrades using windows installer. I would go and now has more explanations to understand the task performed by the team member. Windows Installer supports three types of product upgrades: small updates, minor upgrades, and major upgrades.

A small update consists of product changes, such as hot fixes, so small that no change to the product version is necessary or desired. A minor upgrade means an update to product minor version like 1.1 to 1.2, but there are  no significant changes to the setup organization between versions. The install-time behavior of a minor upgrade is to install over the existing product. A major upgrade means an update to product minor version like 1.2 to 2.0 and  can contain significant changes to the setup architecture. The install-time behavior of a major upgrade can be to uninstall the earlier version and install the new one, or to install over the earlier version and then remove any leftover data of the previous version.

Windows Installer provides different methods for packaging upgrades, and the different options affect the way the upgrade is applied to a target system.An upgrade can be packaged for deployment to the target system as a full installation (MSI package) or Windows Installer patch file (a file with the MSP extension). when the upgrade is packaged as a full installation, it upgrades existing product if one is present, or otherwise to behave as a first-time installation. when upgrade is packaged as a Windows Installer patch file (a file with the MSP extension), it  can be used only to upgrade an existing, installed product, and cannot be used as a first-time installation. Small updates and minor upgrades are commonly packaged as patches, while major upgrades are usually packaged as full installation packages.