How badly do I need the item? If it's not a GOTTA HAVE IT RIGHT NOW, I'll totally put it down and leave. But if I've really gotta have it I'll wait in line debating going to another store. If I know another store does have the item, I might leave and go there depending on my estimation of how long it'll take me to get through the current line versus driving to another store and checking out there.
Something similar happened to me right before Christmas, DH wanted a huge Toblerone from Costco, the day I went up to get it (he's usually with me so I had limited chances to get it) there was a ridiculous amount of people in line, especially considering it was mid day mid week. I opted to put it down and walk out, not much is worth standing in line that long in my mind.
That being said if it were the only store open and we were on our last diaper or something (and no other alternative) I'd end up waiting in line, but it would have to be an extreme case for me, I'm not a patient person....
Where I live we only have one grocery store so that always means a SUPER long line and there is never more than one checkout lane and a couple of self checks. I'm not a very patient person but with it being the only store it means I have to wait