In The Philosopher's Stone, why was the flying key not kept in Dumbledore's office safely far away from the door? Who were they trying to make the stone accessible to that wouldn't be able to simply ask Dumbledore for the key?
No direct canon answer, but a strong suspicion is that he was setting it up that Harry could try his strength and grow.
'D'you think he meant you to do it?' said Ron. 'Sending you your father's Cloak and everything?'
'Well,' Hermione exploded, 'if he did – I mean to say – that's terrible – you could have been killed.'
'No, it isn't,' said Harry thoughtfully. 'He's a funny man, Dumbledore. I think he sort of wanted to give me a chance. I think he knows more or less everything that goes on here, you know. I reckon he had a pretty good idea we were going to try, and instead of stopping us, he just taught us enough to help. I don't think it was an accident he let me find out how the Mirror worked. It's almost like he thought I had the right to face Voldemort if I could...'
(Philosopher's Stone, CHAPTER SEVENTEEN, The Man with Two Faces)
This is somewhat confirmed by his reaction when he met Ron and Hermione (which is what prompted Harry's reply above):
'Well, I got back all right,' said Hermione. 'I brought Ron round – that took a while – and we were dashing up to the owlery to contact Dumbledore when we met him in the Entrance Hall. He already knew – he just said, 'Harry's gone after him, hasn't he?' and hurtled off to the third floor.'
I think the clue is in the fact that Quirrell bothered with the key, when it would surely have been easier for him to magically unlock the door, or blast a hole in the wall, or whatever. The logical conclusion is that it is part of the enchantment; that the magic makes it necessary to use the correct key, eliminating all other options, even magical ones, but that in order for that to work, it must be possible to use the correct key.
That is, if you took the key away and hid it somewhere else, the enchantment would stop working and an intruder could break through the door any way they liked. (You could instead enchant it individually against everything you think the intruder might try, but that's a game of Walls and Ladders.)
Some of the other safeguards worked the same way. Snape's room, for example; why bother with the riddle, rather than just having the enchanted wall of fire, and carrying an anti-fire potion with you if you needed to visit? The fact that the riddle could be solved must have been essential to making it impossible for someone to use their own anti-fire potion, spell, or what-have-you. To my mind, it's the only reasonable conclusion.
I suspect it was to contribute another potentially lethal layer to the protection of the stone - each of the layers of protection to the stone are markedly deadly: poisons, trolls, etc.
Hagrid notes all of the professors who have offered something in the safeguarding of the stone:
“Well, I don’ s’pose it could hurt ter tell yeh that… let’s see… he borrowed Fluffy from me… then some o’ the teachers did enchantments… Professor Sprout – Professor Flitwick – Professor McGonagall –” he ticked them off on his fingers, “Professor Quirrell – an’ Dumbledore himself did somethin’, o’ course. Hang on, I’ve forgotten someone. Oh yeah, Professor Snape.”
— Chapter 14, Norbert the Norwegian Ridgeback
By removing the flying keys (ostensibly enchanted by Flitwick), this would remove a layer of (potentially lethal) protection from getting to the stone.
Alternatively, in the event that Dumbledore's office was burglarized, which is not out of the question based on how often and freely his "pass phrase" is distributed, there would be no real protection.
This isn't an amazingly strong answer, since its entirely conjecture, but I never thought the defended leading to the Mirror were supposed to be all that difficult.
We've got Fluffy first: a bit of music knocks him right out. So, presumably, does a powerful spell. Or you could probably kill him easily enough if you're Voldemort.
The Devil's Snare can be beaten by anyone who's done first year Herbology.
Wizard's chess seems to be a fairly popular past-time, and in any case the chess set's game is casual enough that an eleven year old managed it (Ron was good but hardly a grand master, and Quirrell managed it anyway). The potions were tricky but not impossible. A troll is frankly no challenge. An eleven year old knocked one out with a first year charm, and I'm sure a dark wizard could deal with it without a problem (as he in fact did).
Leaving the flying keys — again, not hard. Finicky. Probably time consuming if you're on your own (Harry, Ron and Hermione herded the key into a corner together in the books). But not difficult.
Each of the defences are beaten quite comfortably by three first year students, two of which barely listened to the one-seventh of their education they've already had. If I'm going to protect something like a Philosopher's Stone, I'm going to try a little harder, so three kids can't get through, with no practice and no prior knowledge of what's to come (bar Fluffy, but Dumbledore didn't know that).
So, I always read the defences as nothing more than a colossal time waster, to give Dumbledore enough time to realise someone's in the castle and take a stroll down there to have a look, especially as the Mirror is the only defence that's any use whatsoever.
So that's my guess as to why the key was kept by the door — to waste the time of whoever tries to get through.