To represent the nodes as mere numbers will not help much to understand the algorithm. It is essential that head, second and reverse are node references, and that each recursive call of the function, has its own, distinct set of variables -- even though their names are the same as in another call.
To get better insight, imagine a numeric suffix to each variable, in order to differentiate them according to the execution context they are defined in. So the top level call will have head1, second1, reverse1, and the first recursive call will have its own head2, second2, reverse2, ...etc.
Let's visualise the list at the moment second has been initialised:
head1 second1
↓ ↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: ———————→ │ next: ———————→ │ next: ———————→ │ next:None │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
Now the recursive call is made, passing it the reference to the second node. In the recursive execution context, this reference is named head, and we also get a new second reference:
head2 second2
↓ ↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: ———————→ │ next: ———————→ │ next: ———————→ │ next:None │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
A similar set of variables gets assigned in the next recursive execution context:
head3 second3
↓ ↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: ———————→ │ next: ———————→ │ next: ———————→ │ next:None │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
The deepest recursive call will have its head referencing the last node:
head4
↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: ———————→ │ next: ———————→ │ next: ———————→ │ next:None │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
This deepest call returns head. The caller (which has its own set of variables), assigns that return value to reverse
reverse3 = head4
head3 second3
↓ ↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: ———————→ │ next: ———————→ │ next: ———————→ │ next:None │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
Then second.next = head and head.next = None get executed:
reverse3
head3 second3
↓ ↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: ———————→ │ next: ———————→ │ next: None│ ←——————— :next │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
This call comes to an end, and returns reverse to the caller. The caller has its own variables, and assigns the returned reference to their reverse variable:
head2 second2 reverse2 = reverse3
↓ ↓ ↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: ———————→ │ next: ———————→ │ next: None│ ←——————— :next │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
Then second.next = head and head.next = None get executed:
head2 second2 reverse2
↓ ↓ ↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: ———————→ │ next: None│ ←——————— :next │ ←——————— :next │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
This call comes to an end, and returns reverse to the caller. The caller has its own variables, and assigns the returned reference to their reverse variable:
head1 second1 reverse1 = reverse2
↓ ↓ ↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: ———————→ │ next: None│ ←——————— :next │ ←——————— :next │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
Then second.next = head and head.next = None get executed:
head1 second1 reverse1
↓ ↓ ↓
┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐
│ value: 1 │ │ value: 2 │ │ value: 3 │ │ value: 4 │
│ next: None│ ←——————— :next │ ←——————— :next │ ←——————— :next │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
This call comes to an end, and returns reverse to the caller. This is indeed the new head of the completely reversed list.