Stackwise election process

One switch in the stack becomes the master that does all “management tasks” for the stack. All other switches are members. If the master fails, another member will become the new master. To select a master, Stackwise uses an election process that checks for the following criteria (in order of importance):

  1. User priority: we can configure a priority to decide which switch becomes the master.
  2. Default Configuration: A switch that already has a configuration will take precedence over switches with no configuration.
  3. Hardware/software priority: The switch with the most extensive feature set has a higher priority than another switch (for example: IP Services vs IP base).
  4. Uptime: The switch with the longest uptime.
  5. MAC address: The switch with the lowest MAC address.

https://networklessons.com/switching/cisco-stackwise/