501711 ÷ 40 
We're looking to find how many times 40 goes into 501711.

On to step 1:
When dividing 5 by 40, we get 0 with a remainder of 5.
Write down 0 as next digit of the result. 
Result so far: 0.0
Deduct 0 from 5 and we're left with 5.
Grab the next digit (0) from the dividend, add it to 5, then carry on: 50 / 40

Going ahead to step 2:
40 can be fit into 50 1 times, resulting in a remainder of 10.
Use 1 as the next digit of our solution. 
Result so far: 1.0
Deduct 40 from 50 and we're left with 10.
Bring next digit (1) of the dividend behind the 10 and repeat the process: 101 / 40

Let's proceed to step 3:
When dividing 101 by 40, we get 2 with a remainder of 21.
The next digit of our result is 2. 
Result so far: 12.0
If we take 80 away from 101, we end up with 21.
Take the next digit (7) from the dividend and append it to 21, then repeat: 217 / 40

Advancing to step 4:
When dividing 217 by 40, we get 5 with a remainder of 17.
Put 5 as the next digit of the answer. 
Result so far: 125.0
If we subtract 200 from 217, we get 17.
Bring next digit (1) of the dividend behind the 17 and repeat the process: 171 / 40

Advancing to step 5:
40 can be fit into 171 4 times, resulting in a remainder of 11.
Record the quotient 4 as the next digit in the result. 
Result so far: 1254.0
The remainder is 11 after subtracting 160 from 171.
Fetch the next digit (1) from the dividend, attach it to 11 and continue: 111 / 40

Going ahead to step 6:
40 goes into 111 2 times with a remainder of 31.
Put 2 as the next digit of the answer. 
Result so far: 12542.0
Subtracting 80 from 111 leaves us with 31.
Since there are no more digits in the dividend, we add a zero to the remainder making it 310, and continue the process.

Moving on to step 7:
If we divide 310 by 40, we get 7 and a remainder of 30.
The number 7 becomes the next digit in our result. 
Result so far: 12542.7
Deduct 280 from 310 and we're left with 30.
Since there are no more digits in the dividend, we add a zero to the remainder making it 300, and continue the process.

Let's proceed to step 8:
40 can be fit into 300 7 times, resulting in a remainder of 20.
Record the quotient 7 as the next digit in the result. 
Result so far: 12542.77
Subtract 280 from 300 to get 20.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

Our division results in 12542.77 with a remaining 0.02.