Which of these statements is correct?
a. Lying in the bed
b. Lying on the bed
a. Leaning against the wall
b. Leaning on the wall
They are not statements, just phrases, and they could all be correct.
Someone is lying in [the] bed when they are under the covers as though ready for sleep. They are lying on the bed when they are lying down on top of the covers, or with the covers removed.
Something like a broom handle (or a person!), or something flat like a folding chair that has been folded, would be described as leaning against the wall of a room. Using on here wouldn't be wrong, but leaning on the wall suggests to me a person standing out of doors and resting their elbows on the top of a low wall.