The usual cause is something hogging your system's resources for a while, so that your keyboard strokes can't be processed. (It's particularly common with systems with low memory). One of the biggest culprits is Microsoft Security Essential's updating service (MsMpEng.exe), which can cause the problem every time an update arrives - but other security suites can sometimes produce the same problem as well.
A further cause of memory hogging is using a browser with too many extensions (or just a few poorly-designed extensions) added on. Some browsers (particularly the otherwise wonderful Firefox) also seem to be prone to 'memory leaks', where the amount of memory used keeps going up the longer you use them for.
When you first turn your computer on, open the Task Manager (via right-clicking on the Taskbar as the foot of your screen). Click on the 'Processes' tab. Check that 'Show processes from all users' is ticked. Maximise the window (so that it fills your screen) and then minimise it to the Taskbar. (It's important to do that BEFORE the problem arises, as you won't be able to quickly open the Task Manager while it's actually occurring).
When you experience the typing problem, maximise the Task Manager window and look for:
(a) a process with a very large figure in the 'Mem Usage' column ; or
(b) a process with a high figure in the CPU column ; or
(c) a process where the figure in the 'Mem Usage' column changes every second or two (even if it's very low).
My guess is that you might find MsMpEng.exe has a constantly changing 'Mem Usage' figure (if you've got Microsoft Security Essentials) or Firefox.exe (if relevant) has a very high 'Mem Usage' figure.
If you track down the problem to a security program updating, try uninstalling it and switching to a different security program. If it's Firefox hogging memory, type 'about:memory' into the address bar, hit 'Enter' and then click 'Minimize Memory Usage'.