This post is part of the book: Hands-On Quantum Machine Learning With Python.
The phase of a qubit is the decisive factor when we work with amplitudes. Even though we can't measure the phase directly, it is not invisible. Once, we can use our simulator to visualize it. Second, we can use math to describe it precisely.
When we look at the Bloch Sphere, states with a positive amplitude reside at the front-side of the X- and Z-axes.

By contrast, states with a negative amplitude reside at the back-side of the Bloch Sphere.

Let's consider some simple states, first. If we rotate the qubit state vector around the Y-axis by the angle θ, we get the following states. For 0<θ<π, we can say the phase is positive (blue). For π<θ<2π, the phase is negative (red).

The figure shows that these states lie on the plane the X- and the Z-axes span. The vector θ specifies the rotation around the Y-axis. Therefore, we call the corresponding gate RY-gate.
Two vectors mirroring each other on the Z-axis have the same measurement probability, such as the two vectors depicted in the figure. They share the same measurement probability, but their phase differs.
The Z-gate
The Z-gate reflects the state of a qubit on the Z-axis. It has the analogous effect of the X-gate that reflects the state on the X-axis. A reflection on the X-axis affects the resulting measurement probabilities because it changes the proximities to the ends of the Z-axis (|0⟩ and |1⟩). But it leaves untouched the phase. Contrariwise, a reflection on the Z-axis flips the phase but leaves the measurement probabilities untouched.
The following equation denotes the transformation matrix of the Z-gate.

The Z-gate turns a qubit in state |+⟩ into state |−⟩. The states |+⟩ and |−⟩ reside on the X-axis. Mathematically, the following equation describes this transformation.

Let's have a look at the effect of the Z-gate programmatically.

Qiskit lets us easily show the qubit state vectors. We define and prepare our quantum circuit as usual (lines 4–11). In this case, we apply a single Hadamard gate on qubit 0 (line 7) and an additional Z-gate on qubit 1 (lines 10–11).
We execute the circuit using the 'statevector_simulator'-backend. But instead of obtaining the counts from the execution results, we call the get_statevector()-function (line 13). The output is an array of the state vectors, like array([ 0.5+0.j, 0.5+0.j, -0.5+0.j, -0.5+0.j]).
We can feed this array into the function plot_bloch_multivector (line 14) we imported from qiskit.visualization (line 2). As a result, we get a Bloch Sphere representation of each qubit.
We can see both vectors reside on the Y-axis. Their amplitudes yield the same measurement probability of 0.5 each. The |+⟩ state-vector points to the positive direction (front) of the X-axis whereas the |−⟩ state-vector points to the negative side (back).
Let's look at another example. Let's rotate the state by a small θ around the Y−axis before we apply the Z-gate.

This second example emphasizes the reflection on the axis. It is not a reflection on the center of the coordinate system.
The Z-gate has a notable property. It does not have an effect on qubits in state |0⟩ and |1⟩. Apparently not, since these two states reside on the Z-axis.

When we look at the math, the situation is straightforward for state |0⟩.

We get a confirmation of the visualization. But how about state |1⟩.

The result of the equation is ambiguous. The resulting state vector is different from the original vector |1⟩.
The phase shift seems to make a difference. But the visualization shows us that the two vectors are identical.

The minus sign does not seem to matter. But what happens if we put this state into superposition?

Again, the visualization tells us that there is no difference between these states. So, let's have another look at the math. If we apply the Hadamard gate on state |1⟩ it results in state |−⟩.

If we apply the Z-gate first, the −-sign jumps from the amplitude of |0⟩ to the amplitude of |1⟩.

Do you remember the post Quantumic Math —Are you ready for the red pill, where elaborate the inability to distinguish between

As we just saw, there's no difference in the resulting state when we apply other quantum gates on either one state. The states α|0⟩ and β|1⟩ form a shared quantum state. For the resulting qubit state vector, it does not matter whether α or β contains the phase.
But let's be a little more meticulous. Qiskit provides another visualization, the "qsphere" representation of a quantum state. In this representation, the size of the points is proportional to the probability of the corresponding term in the state and the color represents the phase.

The figure above shows the qubit in state |0⟩−|1⟩/sqrt(2). We first apply the Hadamard gate (line 5) before we apply the Z-gate (line 6). The phase applies to the amplitude of the state |1⟩. Thus, we only see state |1⟩ shown in turquoise. State |0⟩ remains red. Both circles have the same size for both states have the same measurement probability.
Now, let's apply the Z- and Hadamard-gates on a qubit in state |1⟩ as we did before.

This circuit results in state −|0⟩+|1⟩/sqrt(2). The colors indicate we applied the phase shift on state |0⟩.
So, we can apply the phase to any one of the two amplitudes, α or β. It is important that we don't apply it to both amplitudes because this would effectively revert the overall phase again.

Multi-Qubit Phase
What about if we have multiple qubits? The following equation denotes the state of a two-qubit-system.

The two-qubit system can be in four different states. Each state has an amplitude, too.
In fact, we already specified a two-qubit system above to show two Bloch Spheres side by side. Qubit 0 is in state |0⟩−|1⟩/sqrt(2) and qubit 1 is in state −|0⟩+|1⟩/sqrt(2).
Let's have a look at the overall phases of the four states of this system.

We see two states with a shifted phase, |00⟩ and |11⟩. In this notation, we read the qubits from the right (qubit at position 0) to the left (qubit at position 1). The state |11⟩ gets the phase shift for the qubit 0 has its phase in the amplitude of |1⟩ (as in |0⟩−|1⟩/sqrt(2)). Accordingly, state |00⟩ gets the phase shift for the qubit 1 has its phase in the amplitude of |0⟩ (−|0⟩+|1⟩/sqrt(2)).
Even though this makes sense, it is not the whole truth. Let's see what happens if both qubits are in state |0⟩−|1⟩/sqrt(2). We would expect to see a shift in the phases |01⟩ and |10⟩.

Deviating from our expectation, we see the phase shift in the states |00⟩ and |11⟩. The simple reason is phases are relative. We have two similar yet shifted waves. But how could you tell which of the two waves is the original?

Therefore, we need to settle with the fact we can't tell the difference between

The ability to distinguish between these two states when we use a single qubit is spurious. It already disappears when we add a second qubit.
The following circuit creates the state |0⟩−|1⟩/sqrt(2) on a single qubit.

We see the phase in state |1⟩. See what happens when we define the circuit as a two-qubit circuit.

In a two-qubit circuit, we see the phase in state |00⟩. Accordingly, when we apply a phase shift for one of the two qubits, we see it in the states where this qubit is in state |1⟩.

In this case, we put both qubits into a state of superposition by applying Hadamard gates (lines 4–5). We shift the phase of the qubit at position 0. Therefore, we see the states that differ for this qubit (at the right-hand-side) having different phases. States with qubit 0 in state |1⟩ have a different phase than the states with qubit 0 in state |0⟩. Again, Qiskit makes only sense of the relative phase and indicates the shift for the states where qubit 0 is in state |0⟩. The global phase is unobservable.
Conclusion
Global phases are the artifacts of the mathematical framework we use. They don't have a physical meaning. If two states differ only by a global phase, they effectively present the same physical system.
By contrast, relative phases are the core of quantum mechanics and therefore, of utmost interest in quantum computing. If two states differ by a relative phase, they are different systems that evolve in different ways. Even though they appear identical if measured separately, they have different effects when interfering with other quantum systems.
This post is part of the book: Hands-On Quantum Machine Learning With Python.

Get the first three chapters for free here.