We look at the division of 501561 by 40 
We want to figure out the number of times 501561 can be divided by 40.

Step 1:
40 goes into 5 0 times with a remainder of 5.
The next digit of our result is 0. 
Result so far: 0.0
If we take 0 away from 5, we end up with 5.
Append the next digit (0) from the dividend to 5 and continue with: 50 / 40

On to step 2:
50 divided by 40 is 1 with a remainder of 10.
Write down 1 as next digit of the result. 
Result so far: 1.0
Deduct 40 from 50 and we're left with 10.
Include the next digit (1) from the dividend after 10, then repeat: 101 / 40

Advancing to step 3:
40 goes into 101 2 times with a remainder of 21.
Write down 2 as next digit of the result. 
Result so far: 12.0
Deduct 80 from 101 and we're left with 21.
Fetch the next digit (5) from the dividend, attach it to 21 and continue: 215 / 40

Let's proceed to step 4:
When dividing 215 by 40, we get 5 with a remainder of 15.
Put 5 as the next digit of the answer. 
Result so far: 125.0
Subtract 200 from 215 to get 15.
Append the next digit (6) from the dividend to 15 and continue with: 156 / 40

Advancing to step 5:
40 can be fit into 156 3 times, resulting in a remainder of 36.
Record the quotient 3 as the next digit in the result. 
Result so far: 1253.0
Subtract 120 from 156 to get 36.
Bring next digit (1) of the dividend behind the 36 and repeat the process: 361 / 40

Advancing to step 6:
361 divided by 40 is 9 with a remainder of 1.
The next digit of our result is 9. 
Result so far: 12539.0
Subtracting 360 from 361 leaves us with 1.
Since there are no more digits in the dividend, we add a zero to the remainder making it 10, and continue the process.

Going ahead to step 7:
40 can be fit into 10 0 times, resulting in a remainder of 10.
Use 0 as the next digit of our solution. 
Result so far: 12539.0
Subtracting 0 from 10 leaves us with 10.
Since there are no more digits in the dividend, we add a zero to the remainder making it 100, and continue the process.

Moving on to step 8:
40 can be fit into 100 2 times, resulting in a remainder of 20.
Write down 2 as next digit of the result. 
Result so far: 12539.02
Subtracting 80 from 100 leaves us with 20.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

Moving on to step 9:
When dividing 200 by 40, we get 5 with a remainder of 0.
Write down 5 as next digit of the result. 
Result so far: 12539.025
The remainder is 0 after subtracting 200 from 200.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Step 10:
When dividing 0 by 40, we get 0 with a remainder of 0.
Write down 0 as next digit of the result. 
Result so far: 12539.025
The remainder is 0 after subtracting 0 from 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Let's proceed to step 11:
40 goes into 0 0 times with a remainder of 0.
Write down 0 as next digit of the result. 
Result so far: 12539.025
Subtract 0 from 0 to get 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

After the division, we end up with 12539.025 and a remainder of 0.0.