Thank you, however, I doubt this is how electrum (or bitcoin wallets) get the fees for Sending btc.
I'm not sure how Electrum calculates it (perhaps ask in the Electrum forum?) I suspect they do some (if not all) of those steps.
It is probably a pretty good description of what bitcoinfees.earn.com is doing.
I am sure there is a simpler way
Sorry, I thought you wanted accurate. If you just want simple...
Step 1. Look at the most recent block in the blockchain.
Step 2. Add up all the values of all the inputs in the block.
Step 3. Subtract the values of all the outputs in the block (skip the coinbase transaction)
Step 4. Divide by the number of bytes in the block.
The result will be the AVERAGE fee per byte paid by transactions in the block. Adjust higher or lower as you see fit to increase or reduce your risk of waiting.