When will y’all give someone a warning instead of a ticket?

I’ve seen that for example when someone is stopped for speeding, sometimes the driver is let go without a ticket where another time they will get a ticket regardless. Would it be if because y’all care or just time or whatever reason?