What are possible reasons for external keyboard input lag? I have a "Microsoft Sculpt Ergonomic" keyboard, connected with USB to my Mac 13" (from 2018). The keyboard input starts to lag at some random times. I have been using the keyboard on my older Mac 15" (from 2015) for more than a year and never had a problem. Both Macs are with the same OSX version (Mojave 10.14.4). 

I thought the problem is in the batteries (it uses 2xAAA batteries). Changed them with brand new ones. Issue persists.

I tried connecting a Magic Apple keyboard and at moments when the Microsoft keyboard lags, the Apple one does not.

Most often the problem happens within the browser, but continues persisting in Slack, IDEs and other apps. It is strange, thought, that the lag occurrences are not connected to higher load on the CPU or memory.
The lagging sounds like wireless interference to me.

Many devices can be the culprit; wireless routers, displays, other Bluetooth and WiFi enabled devices, and even devices attached via USB 3.0 cables with poor shielding.

The closer you can get your USB dongle to the keyboard, and the further it can be from sources of interference, the better. A good USB extension cable might be what you need to take care of this issue.