This is the sort of issue that happens all the time with toddlers and preschoolers: when sufficiently well rested and fed, they're polite and well behaved, but when something's amiss things go poorly.
When this happens with us, we address it by triaging the problem first, and then make a choice based on that result.
Why did he refuse to ask nicely?
- Because he was tired
- Because he is hungry
- Because he is a bit sick
- Because of a behavioral issue
If he's hungry, we definitely have a solution - food! Think about when he last ate. If it's several hours ago, he might be hungry for a snack. Redirection can accomplish this, and then when the snack is finished remind him about the cars.
Johnny, please ask nicely if you want to have a car.
Want car. Give me car.
Johnny, you know what, you look hungry. How about some watermelon?
Want apple.
Okay, an apple sounds like a good plan. Let's go do that now.
Here I don't insist on asking politely, because I know it's counterproductive. He isn't going to learn anything by insisting here - it's just going to produce a negative reaction and end up with a worse situation. That's worth the small loss, and you can reinforce the "ask nicely" with the car later.
If he's tired or sick, you may not be able to correct that right away - certainly suggesting a nap is probably going to fail utterly, at least for us. But what you can do is redirect for a while.
Redirection to a different toy/activity can help here; you get out of the situation, at least. I always try to tell him why we're doing this and why we should ask nicely, in the process.
As a side note, sometimes in these cases you end up in a fit and tears - but it actually helps him out, because it sets him up for sleep. That's not ideal, but it seems at least to me that it nonetheless is helpful.
Johnny, please ask nicely if you want to have a car.
Want car. Give me car.
Johnny, I'm sorry, but if you want a car you need to ask. They're not out where you can get to them, because you're not good enough at putting things away yet to have free access. Mommy and Daddy don't want to put away your toys for you all the time, and if there are cars on the floor we might step on them and hurt our feet! You also might lose your cars if they don't get put away.
Don't want lose car.
Maybe we should do some coloring instead. I bet I could find some paper and crayons for you to color with.
Want purple crayon.
Sounds like a good plan.
Again, I'm not going to push for "Ask nicely" when it's a small alteration to my suggestion, as I don't want to end up in a negative circle. Again, once the coloring is done, we'll circle back to this.
Johnny, we're all done coloring now. Would you like to play with cars now?
Yes, want car.
Okay. Then let's practice what we do when we want a car. What do you say to Daddy if you want a car?
Please can I have car.
Now you have your 'ask nicely' practice in, didn't give in to the misbehavior, but also avoided a major conflagration.
Finally, there are the behavioral issues - where your child knows he should be asking nicely and simply doesn't feel like it right now, despite not having any systemic problems making this difficult. This tends to crop up more as he gets older, 3 or 4.
Here my preference is to treat it similarly to tired/sick above (with redirection), except to try a bit harder at first to gain cooperation.
Johnny, please ask nicely if you want to have a car.
Want car. Give me car.
Johnny, I'm sorry, but if you want a car you need to ask. They're not out where you can get to them, because you're not good enough at putting things away yet to have free access. Mommy and Daddy don't want to put away your toys for you all the time, and if there are cars on the floor we might step on them and hurt our feet! You also might lose your cars if they don't get put away.
Don't want lose car. Want car.
Johnny, if you want a car, please ask Daddy politely. You say "please", because it is a nice thing to say to someone helping you with something. If you only say "I want", it sounds like you don't want to be nice to Daddy.
Want car. Get car.
I'm sorry Johnny, but we need to please use our nice words, or we'll have to do something else.
Want car.
Okay, Johnny, how about we do something else. How about a puzzle?
Daddy say please.
Good point Johnny - Daddy should definitely ask nicely! Please, Johnny, can we do a puzzle?
Okay daddy. Please puzzle.
And again, once the puzzle is done, you can circle back to the 'please-car' issue just like earlier.
One thing I inserted in all of this was to consistently model "please" during these conversations. In the parent-child relationship, it can be easy to get into the habit of "telling" instead of "asking", particularly when frustrated by behavior. This is a big problem - why after all will your child say "please" if you don't always do so? It's definitely something I have a lot of room for improvement on. I pointed it out in the last example of course, but even if your child doesn't call you on it, it's important to model as often as you can - that way it becomes automatic, and when you say "this is what we do as part of social behavior", your child understands what you mean and sees you doing it.