I had my keys stuck in the ignition and I ended up taking a lot apart and figuring out how everything works. This problem can be either electrical or mechanical.
If it is electrical you will not hear anything when switching the selector to park and also when pushing on the brake. The stop light switch is depressed when you let of the brake. You will find it near the brake pedal. There is also a switch that is activated when the selector is in P. These connect to the relay switch which activates the solenoid next to the selector. You can hear the relay switch when you put the selector into park and also when you depress the brake pedal. To check if the relay is bad replace it with one from under the hood (I used the one for the headlights).
I would imagine that if any four of those electrical components (stop light switch, solenoid, relay switch or selector park switch) goes bad that it would cause the keys to get stuck.
The mechanical side is a bit more straight forward. There is a mechanism in the steering column that won't let you turn the key to lock when the car is in gear and also won't let you put the car in gear when the key is not in and turned.
If the cable between the selector and the ignition switch is too loose you can put the car in gear without the key. Too tight and the key won't turn to lock. This was what happened to mine.
To fix it I tweaked a bracket that held the cable, but it was too loose. Then I saw the device on the other end that looked like it was to adjust the tension on the housing.
To really fix it you must get the little lock off of the adjustor. There are two little tabs on each side that you can release with a small screwdriver.
Put the adjustor back into place without the lock and put the key in the ignition, switch it to on. Pull the cable housing near the adjustor tight and place the lock back in. The lock is designed to add the right amount of slack in the cable when it is pushed all the way in.