There was much to and fro about how London Marathon places are allocated, I knew the basics but not the numbers, here are the numbers for 2016
"Elite entry (less than 100 places): only those of you with legendary race records need apply.
Celebrity entry (less than 100 places): if you think you’re famous and have a cause or story that is newsworthy then get in touch with the organisers.
Championship entry (approx 1000 places): running a sub 2:45 marathon (for men) or sub 3:15 (for women) – or an equally rapid half marathon time.
Good For Age entry (approx 5000 places): a sub 3:05 marathon (for men aged under 40) or sub 3:45 (for women aged under 40) – times get more lenient as you get older.
https://www.virginmoneylondonmarathon.com/en-gb/how-to-enter/good-age-entry/
British Athletics Club entry (less than 1000 places): British Athletic affiliated clubs can apply for places based on the number of adult members – but don’t expect many, it’s a place for every 100 members.
Charity entry (approx 15000 places): promise to raise money for a huge variety of good causes but don’t be surprised to have to go through a selection process, such is the demand for places."
The other method is the public ballot, I gather for 2017 there were 250000 people vying for 17000 entries.