Many iPhone /iPod touch users have this problem, especially iPhone 2G/3G users and iPod touch 1G/2G users. Because these iDevices have low RAM (128 MB) and low processor (412 MHz), So what to do???
Should we upgrade to iPhone 3Gs or 4 or 4S??? I say NO, the keyboard lag annoys but upgrade is not the only solution, Well it is a very good excuse to buy new iPhone / iPod touch but I don't suggest that, instead I'll show you a fix which works like charm and if it didn't work then your idevice must be broken or it had some hardware issues. If you idevice is perfect then you don't have to worry about that.
So let's begin
1) Go to settings > General > Search results.
2) Now unselect Contacts (searching contacts makes keyboard lag)
3) also unselect things you don't need. Eg audiobooks, mail, videos, notes etc. Many people don't need them, so unselect them.
4) Now Respring or Reboot you idevice.
After Reboot go to spotlight search and Try searching something and see if keyboard works without lag.
I hope it works for you, because it always works for me.
Please leave a comment if this post helped