Why do Stack Overflow question URLs have the question ID before SEO friendly 'question'?
I do not know exact reasons why StackExchange sites do have ID before slug, but here is why I would have it this way:
Sometimes URL can be truncated (intentionally (too long to store in DB etc) or by mistake (happens quite often when copy-paste)) .. and if ID is before slug, the server/script can still recognize the page you want but with ID at the end it most likely will not.
Try URL of this page -- remove last few characters and submit -- server will redirect you to the correct URL (apparently the code behind this site has special treatment for such scenario). With ID at the end you possibly would see completely different question (the most common behaviour in such case).. or just error page (when server/script ensures that slug matches ID).
With regards to SEO effect -- see this question: SEO : urls : best place for the id
Yes, it's they could have added the ID after the question title if they had wished.
Regarding the position of the ID and SEO, in my opinion I don't think it would make any difference (ok maybe if it was in the domain name).
From a human readability point of view, it seems clearer (to me at least) to have the human readable title at the end, rather than burried in the URL.
I also read in an article that only the first two subdirectories are relevant therefore only /question/16999 is relevant. Looking at SO this is definitely not true, but I can't decide on the weigh of this
Where did you read this? I don't think it is correct, and nowadays these re-written URLs don't usually relate to subdirectories in any way.
The processing of the URL by the server is ignoring the portion of the URL following the question id number and slash. All of these are equivalent:
They all redirect to the URL having the (reformatted) question text after the slash.
This allows them to use the short form URL in links from one page to another (such as the links in the Related sidebar on this page), saving HTML transmission time as well as storage and cpu cycles. By having the question-text in the canonical URL (the one redirected to), they still get the benefits of having relevant text in the URL for use in search engine indexing.