As I have learnt, when bonding takes place in an atom, such as carbon, the electron in its $s$-subshell gets excited and jumps to the open spot in the $p$-subshell. This is why carbon is able to form 4 bonds, rather than just two. My question is, when the electron jumps into the higher position shell, why does it change its spin? And also, how does it change its spin?
it is not just that every transition would result in the change of spin this occurs only some times which is explained below
The Pauli Exclusion principle states that two electrons in an atom cannot have the same four quantum numbers (n, l, ml, ms) and only two electrons can occupy each orbital where they must have opposite spin states. These opposite spin states are called spin pairing. Because of this spin pairing, most molecules do not exhibit a magnetic field and are diamagnetic. In diamagnetic molecules, electrons are not attracted or repelled by the static electric field. Free radicals are paramagnetic because they contain unpaired electrons have magnetic moments that are attracted to the magnetic field.
Singlet and Triplet Excited State Singlet state is defined when all the electron spins are paired in the molecular electronic state and the electronic energy levels do not split when the molecule is exposed into a magnetic field. A doublet state occurs when there is an unpaired electron that gives two possible orientations when exposed in a magnetic field and imparts different energy to the system. A singlet or a triplet can form when one electron is excited to a higher energy level. In an excited singlet state, the electron is promoted in the same spin orientation as it was in the ground state (paired). In a triplet excited stated, the electron that is promoted has the same spin orientation (parallel) to the other unpaired electron. The difference between the spins of ground singlet, excited singlet, and excited triplet is shown in Figure 1. Singlet, doublet and triplet is derived using the equation for multiplicity, 2S+1, where S is the total spin angular momentum (sum of all the electron spins). Individual spins are denoted as spin up (s = +1/2) or spin down (s = -1/2). If we were to calculated the S for the excited singlet state, the equation would be 2(+1/2 + -1/2)+1 = 2(0)+1 = 1, therefore making the center orbital in the figure a singlet state. If the spin multiplicity for the excited triplet state was calculated, we obtain 2(+1/2 + +1/2)+1 = 2(1)+1 =3, which gives a triplet state as expected.
Figure 1. Spin in the ground and excited states The difference between a molecule in the ground and excited state is that the electrons is diamagnetic in the ground state and paramagnetic in the triplet state.This difference in spin state makes the transition from singlet to triplet (or triplet to singlet) more improbable than the singlet-to-singlet transitions. This singlet to triplet (or reverse) transition involves a change in electronic state. For this reason, the lifetime of the triplet state is longer the singlet state by approximately 104 seconds fold difference.The radiation that induced the transition from ground to excited triplet state has a low probability of occurring, thus their absorption bands are less intense than singlet-singlet state absorption. The excited triplet state can be populated from the excited singlet state of certain molecules which results in phosphorescence. These spin multiplicities in ground and excited states can be used to explain transition in photoluminescence molecules by the Jablonski diagram.