509981 ÷ 40 
Our goal is to divide 509981 by 40.

Let's proceed to step 1:
If we divide 5 by 40, we get 0 and a remainder of 5.
Use 0 as the next digit of our solution. 
Result so far: 0.0
If we subtract 0 from 5, we get 5.
Grab the next digit (0) from the dividend, add it to 5, then carry on: 50 / 40

Advancing to step 2:
40 can be fit into 50 1 times, resulting in a remainder of 10.
Record the quotient 1 as the next digit in the result. 
Result so far: 1.0
Deduct 40 from 50 and we're left with 10.
Grab the next digit (9) from the dividend, add it to 10, then carry on: 109 / 40

Advancing to step 3:
40 goes into 109 2 times with a remainder of 29.
The next digit of our result is 2. 
Result so far: 12.0
If we subtract 80 from 109, we get 29.
Include the next digit (9) from the dividend after 29, then repeat: 299 / 40

Advancing to step 4:
40 can be fit into 299 7 times, resulting in a remainder of 19.
Record the quotient 7 as the next digit in the result. 
Result so far: 127.0
If we take 280 away from 299, we end up with 19.
Take the next digit (8) from the dividend and append it to 19, then repeat: 198 / 40

Let's proceed to step 5:
198 divided by 40 is 4 with a remainder of 38.
The next digit of our result is 4. 
Result so far: 1274.0
Deduct 160 from 198 and we're left with 38.
Grab the next digit (1) from the dividend, add it to 38, then carry on: 381 / 40

On to step 6:
40 goes into 381 9 times with a remainder of 21.
Record the quotient 9 as the next digit in the result. 
Result so far: 12749.0
Deduct 360 from 381 and we're left with 21.
Since there are no more digits in the dividend, we add a zero to the remainder making it 210, and continue the process.

Let's proceed to step 7:
40 goes into 210 5 times with a remainder of 10.
The number 5 becomes the next digit in our result. 
Result so far: 12749.5
Subtracting 200 from 210 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.

Going ahead to step 8:
40 goes into 100 2 times with a remainder of 20.
Put 2 as the next digit of the answer. 
Result so far: 12749.52
If we take 80 away from 100, we end up 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:
If we divide 200 by 40, we get 5 and a remainder of 0.
Record the quotient 5 as the next digit in the result. 
Result so far: 12749.525
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.

On to 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: 12749.525
Subtracting 0 from 0 leaves us with 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Step 11:
When dividing 0 by 40, we get 0 with a remainder of 0.
The next digit of our result is 0. 
Result so far: 12749.525
If we subtract 0 from 0, we 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.

In conclusion, the division gives 12749.525 with a balance of 0.0.