Keystrokes getting eaten randomly
There can be two reasons: software or hardware.

Software

This is most likely caused by the CPU being overloaded, so the kernel is throttled. That means only number of samples that are processed for a specific period to avoid overheating to prevent the crash.

To confirm that, run the following command in Terminal:

sudo fs_usage | grep -v 0.00


which should show something like:

THROTTLED  0.015030   kernel_task
...
THROTTLED  0.019601   coreduetd
THROTTLED  0.031014   kernel_task 
...
THROTTLED  0.014947   kernel_task


which means your kernel being throttled which may result in such unexpected behaviour (see also: Why kernel may be throttled?).

I had this problem when my system was eating t letter (for all the apps) and CPU sensors (in iStat) were over 90˚

To solve the problem, check the above command fs_usage and kill unnecessary processes. If it's web browser with too many tabs and a lot of ads and JS scripts in the background, close unnecessary tabs.

There is also a chance that it's caused by I/O throughput (disk access) and your storage (e.g. SSD) may be reaching its lifespan.

Hardware

If keystrokes are eaten consistently (like the same letter over and over again), this could be physical keyboard issue.

Before blame the hardware, you should try to:


Reset NVRAM.
Reset the System Management Controller (SMC).


If that won't work, you should arrange appointment at a Genius Bar.

For temporary workaround, see: How to deal with non-working key on the keyboard?