Okay, so a question about NPIs. Is "any" always an NPI? We would say "I don't like anything you do" but also "I like anything you do" (no negative). Unless someone would argue the "anything" in the second sentence should become "everything"; thus, "I don't like anything you do" versus "I like everything you do" (except "every" is also considered an NPI?). Basically NPIs are super interesting to me, but everything I've ever read on them confuses me even more.
“Any” is not, in fact, always an NPI. (Here’s a previous post on Negative Polarity Items, for reference.) In the sentence “I like anything you do”, “any” is a Free Choice Item (FCI). Free Choice Items are, if anything, even more interesting and complicated than NPIs.
In general, FCIs expand the range of choices that you’re talking about: “I can read a book” leaves open the possibility that there are some books I cannot read, but “I can read any book” explicitly says that all books are a possible option. NPIs, on the other hand, make things more negative: “I don’t read any books” is stronger than “I don’t read books”. This might make FCIs look like the opposite of NPIs, but it’s actually more complicated than that.
Let’s set up a couple examples so we can talk about them.
1. a. I wrote anything that I liked.
b. *I wrote anything.
c. I am writing anything that I like.
d. *I am writing anything.
e. I might be writing anything.
f. I write anything that I like.
g. I write anything.
h. I know anything that you could ask.
i. *I know anything.
j. I could know anything.
2. a. I didn’t write anything that I liked.
b. I didn’t write anything.
c. I’m not writing anything that I like.
d. I’m not writing anything.
e. I might not be writing anything.
f. I don’t write anything that I like.
g. I don’t write anything.
h. I don’t know anything that you could ask.
i. I don’t know anything.
j. I couldn’t know anything.
All the (1) examples are free-choice any, whereas all the (2) examples are negative-polarity any. What’s the difference?
Well, for one thing, you’ll notice that NPI any sounds fine in any of the sentences in (2), whereas FCI any sounds weird in several of the equivalent sentences in (1) (marked with asterisks). So while NPIs are okay in any context where you have negation (plus some other contexts), FCIs aren’t okay in any context where you have a choice. The sentences where FCI any is okay are specifically those where you have a choice, but it’s actually limited somehow: by a relative clause (”that I liked”, “that you could ask”) or by a modal (”might”, “could”).
The only exception to that limit is (1g) “I write anything”, and that’s actually because of a weird quirk of English verb conjugation: the normal present tense for a dynamic verb like write is actually the progressive (”I am writing”). When a dynamic verb used in the simple present tense, it indicates a generic or habitual activity. For example, “I write poetry” is equivalent to “(As a rule / In general / Habitually,) I write poetry” and not “I am writing poetry (right now).” By contrast, stative verbs like know are in fact used in the simple present in English to describe an activity that’s going on right now: you’d say “I know the answer (right now)” and not “I am knowing the answer” but “I am writing the answer (right now)” and not “I write the answer”. (Other languages, even those that have a progressive, like Spanish, don’t generally use it in this manner.)
So this additional generic meaning that comes along with “I write” is enough of a restriction to make “I write anything” (=As a habit, I write anything) sound okay with any. But because “I know” isn’t generic, it doesn’t come with this restriction, and therefore it sounds bad* with any.
*Probably. If you think about “I know anything” long enough, you may be able to get it sounding okay for you, probably by mentally pushing it over towards more of a generic.
This is a basic description that I think linguists broadly agree on, but how exactly various free choice items work is still an active area of research, and it’s especially fruitful in languages that, unlike English, have different words for NPIs and FCIs. Many languages also express some of this range of meaning with a fixed phrase instead of a single word, or have free-choice-type expressions that you can’t say in exactly the same contexts as English any. For example, French rien and personne are NPIs, but the equivalent FCIs are n’importe quoi and n’importe qui; Spanish nada and ningùn/ninguna are NPIs, but it has several FCIs with slightly different uses, including cualquier/cualquiera, un/una [NOUN] cualquiera and some uses of algùn/alguna.
Other words that often get discussed with any include some, even, ever, just, and only. As a group, the set of words like anyone, somewhere, nothing are called indefinites or indefinite pronouns, and there’s a bit more information about them from a typological perspective in WALS and from a theoretical perspective in this handout and a lot more information in Haspelmath 1997.
There is, alas, no Wikipedia article on free choice items or indefinite pronouns that I can refer you to, and even the article about NPIs is pretty sketchy (hey semanticists, want to help fix this? There are a couple #lingwikis coming up…) so at the moment you’d pretty much need to find a textbook or look at the original literature to learn more, but at least this gives you a few keywords to look up.