Reading some reviews there seem to be two reasons for lagging that comes up now and then for the Logitech M510: 1) Transmitter range, and 2) Dirt on the sensor
1) Transmitter rangeA lot of people seem to have had issues with the the short range between the transmitter in the mouse and the USB plug receiver. This is very good for the battery life, but not so good if the mouse and the receiver are too far apart. One way around this is to buy a USB extension cord long enough that the USB receiver can be on the far side of the keyboard, just a few decimeters (a feet) or so away from the mouse instead of perhaps a meter (yard) or two.[1]
2) Dirt on the sensorAnother cause for lag that seem to be more rare is dirt on the sensor underneath the mouse, as I understand it a laser and a camera. From the older Logitech G5 that I currently use I have to now and then remove hairs and other dirt from the small cavity with the lenses for the laser and camera. I do this with a pair of fine tweezers, staying well clear of the lenses and being
very careful to not scratch them. I guess a cotton swab could be used, but it would definitively leave cotton fibers that need to be picked out.
____
[1] I for some time used a very cheap wireless mouse that I needed to do that with. With the receiver only about 3 decimeters (1 foot) away from the mouse instead of slightly more than a meter (yard) away it worked great. Unfortunately it used up a pair of batteries in just two weeks, even though I always turned it off when not using it. Probably a downside of using a cheap one.