Could be "did you take the keys lying on the table
, next to window/the TV?" or something like "what happened to key that was on the table? Did you take it
?"/where are the keys that were on the table?...did you take it?
In your case: "did you take the key that was lying on the bed?/did you take the keys that were lying on the bed?"
Notice that with DID (so, with questions with DID/DO, etc) the DID indicates that the verb is on a past tense. Also with DID/DO/DOES etc, the verb conjugation is "killed", that is, after DID/DO/DOES the following verb comes in its infinitive form: work = work (not worked/works, etc), grin = grin (not grinned/grins...).
That happens to negative sentences and questions with the auxiliary verbs DO/DID/DOES.
I hope this helps!