You have to cast the spell before the NPC dies, then kill the NPC while the spell effect is active.
As for casting a spell, the Tome is just to teach you how to use the spell. You ready it from the Power Menu and choose the spell itself. The Spell is what you would also Hotkey.
Me, I use a weapon that has the spell effect, it makes this much easier
In addition to what Shadow said, you must also have the proper empty soul gem to capture the soul.
http://www.uesp.net/wiki/Skyrim:Soul_Trap_(effect)
Great. Thanks so much. Not sure why I find some of these things difficult except maybe that I'm ancient.
Thats the great thing about this forum. Everyone looks out for each other and helps out in any way we can.
I agree; you're all very good to take time to answer basic questions. Good people. I've experienced it on other forums as well. If only the rest of the world felt the same way about life...