What is your Intelligence score?
I think we can look at this like a program. We are doing so ONLY as a method of thinking about this problem, NOT because this is how the game works. Below I will describe an update loop and the like, but the game does not run on such a thing. This is based on the phrasing.
The headband is not a one time occurrence, it is a continuous loop. It uses the word while.
Your Intelligence score is 19 while you wear this headband.
If we look at it like a program, we're setting the Intelligence to be 19 every "update". Or rather, every moment in time. Is the headband on? if yes, your intelligence is 19.
Feeblemind is a one time effect, meaning one time and one time only, we're setting the creatures Intelligence and Charisma to be 1. It has a duration of "Instantaneous", which implies that the effect is not contingent on the duration of the spell -- It is not 1 "while this spell is active", like the way the headband sets your intelligence to 19 "while you wear this headband". It is just set to 1. Without interference, your intelligence will stay 1.
When the headband is considered, your intelligence becomes 19. You can wear the headband because that is not the same as activating it, which the spell prohibits. If the headband's wording used "when" or "after" you put the headband on, we could conclude that Feeblemind would win out, as it was the latest effect on your intelligence. But because it uses "while", we treat it as a continuous effect.
Can I communicate, understand language, cast spells, and activate magic items?
Because of the wording of the spell, you still cannot speak, cast spells, or anything like that. The spell does not give a condition on the secondary effects' end, other than the spells that can dispell it, so we must conclude that the effects are ongoing as part of the spell itself, not because of the mental scores of the target. It is not because of the intelligence score that you cannot do those things, they are separate from each other.
Furthermore, Intelligence is not described as being important for language. Page 12 of the PHB states that Intelligence is a measure of mental acuity, information recall, and analytical skill. On page 17 of the PHB, you know certain languages "by virtue of your race". You also acquire some from your background. In the DMG page 278 for the language of a created monster, there are no ability score requirements for language. There are some spells that don't work on creatures of poor Intelligence, some of them regarding communication, but other than that there is no other requirement to be able to understand or speak a language. If you want more reasoning, there is a very good answer for a similar question I posed regarding Intelligence and Language
We must treat the inability to understand languages, activate magic items, etc etc, as an effect that the spell is having on your character, not as an effect the low intelligence is having on him/her. Call it "brain fart on steroids" if you want. You're smart, but you just can't do certain things. Your Intelligence is 19, you're very good at recalling information and can make good saving throws, but you cannot cast spells, activate magic items, understand language, or communicate in any intelligible way.
It's up to the DM to decide, but you're asking for trouble if it does come with languages.
I'm going to answer my own question here, because I spent all night thinking about it and I don't think it's right to expect this much detail from anybody else.
I don't think this actually can be resolved with the rules as written. The other answers so far both say essentially the same thing: it's up to the GM. That said, I think there's a lot the GM would have to think about. Here I'm going to argue that the cleanest option is to rule that the headband's granted ranks do not allow a character to learn a new language. But I will also comment on what the GM will also have to rule if they rule otherwise.
Why Linguistics is Problematic
Languages are a separate system from skills. Many characters will never take a rank in linguistics, and simply speak languages based on their race and starting intelligence bonus.
Linguistics is an oddball skill in Pathfinder for two reasons. First, it is the only skill for which taking a rank in it grants an ability that can be used without a skill check. Second, and more importantly, linguistics is the only skill that comes with any kind of option or choice. When a character puts a rank in knowledge (local), they do not choose a different locale for each rank. When a character puts a rank in disable device, they do not choose a different kind of trap or lock to focus on. Linguistics is the only skill that involves a choice while gaining a rank (viz., choosing a language.)
Because linguistics is unique, there are really no other situations we can refer to when trying to come up with a ruling about how exactly the language-learning ability works. (The same applies to D&D 3.5's speak language skill, and so we can't look at 3.5 for guidance here. 3.5 sidestepped this whole problem because the headband of intellect didn't grant skill ranks; I see the wisdom in that design decision now!)
A Possible Rules-as-Written Argument
The rules-as-written debate centers around the wording of the linguistics skill: "whenever you put a rank into this skill, you learn to speak and read a new language."
There is a related debate with regard to familiars and the linguistics skill. Familiars use their master's ranks in place of their own, and so many players have wondered whether a familiar who gains its master's ranks in linguistics also gets to speak, understand, read, and write the languages its master chooses. (Or better yet, whether the familiar can choose different languages than its master chose.) Of course, most familiars probably cannot speak or write those languages because of anatomical issues.
The rules-as-written debate centers around the language of "put a rank into this skill." Some players have argued that familiars simply have ranks, which is distinct from putting ranks into that skill. See, for example, this thread on Paizo's forums. Any effect that simply replaces your own ranks, it is argued, is functionally different from putting ranks into the skill, and you do not get any added bonus that comes from putting ranks into it.
At the same time, I have seen this masterwork of rules-lawyer-ing that argues differently. The writer points out that there is one place in the rules that uses similar language to the linguistics rules: class skills. The rules read, "You gain a +3 bonus on all class skills that you put ranks into." It is widely assumed that familiar get class skill bonuses for skills it "borrows" from its master; therefore, if we apply the same interpretation to both usages of the verb "to put", it would imply that familiars should also learn languages based on linguistics.
I think that most people assume class skill bonuses apply to a headband's granted skills, and so therefore by the same argument, if linguistics is granted by the headband, you also get languages.
I think that latter argument is actually pretty strong from a pure rules-as-written standpoint. That said, I also believe that these debates bring us far past whatever the game designers may have intended; I doubt that the designers ever consciously thought about "put a rank" having a very technical meaning that they consciously considered both when writing the linguistics rules and when writing the class skills section. And so, even if the latter argument is stronger, I don't think any rules-as-written argument is going to be really satisfying here, and it should be just one factor weighing against others.
Assuming you do get the languages... and they're "stored" in the headband
So, let's assume you rule that a headband of vast intelligence that contains linguistics skill ranks grants the wearer languages. What then?
Immediately, you are faced with the problem of how to determine those languages. There are two approaches: either the creator chooses those languages associated with the skill ranks, or the player chooses those languages. Both of these approaches lead to counterintuitive results.
Intuitively, it feels like the choice of languages should be fixed at creation time. After all, bonus languages (the languages gained from a high intelligence bonus) are fixed at creation time, as are skill ranks. This seems to set a precedent that all choices made for abilities granted by the headband are fixed at creation time.
But this gets weird, very fast. The languages granted by linguistics are different from the other decisions made by the creator, in that there's a different choice to be made for every individual rank of the headband. If we're serious about making these choices at creation time, that means we should have a list of languages that should be taken in a particular order. That seems like a lot of book-keeping, though an interesting compromise position would be that the DM gets to decide on the language learned rather than the player.
Another answer to this question suggested that the creator can only store the knowledge of languages the creator knows. (This was based on the assertion that the creator can also only store the knowledge of skills they know, but I can't find any evidence for that assertion. After all, the wearer of a headband may well have more hit dice than the creator, and thus end up with more skill ranks—and hence more training—than the creator, and so I don't think there's really a solid argument that the creator has to know the skills.) But that would be odd: presumably there would be a point where wearer has exhausted all the languages the creator knew. Would they stop gaining languages as they gain hit dice? That seems odd.
Another possibility is that the creator designates a "pool" of languages associated with the headband. But how large should this pool be? Do you need to designate 34 languages in case Great Old One Hastur kills you and takes your headband? Or 40 in case a Tengu decides to wear your headband? (It has been suggested in another answer that a Tengu's "gifted linguist" racial feature should be overridden; as a player I would be pretty disappointed by that, especially since there doesn't seem to be solid RAW support for it.) Really, the "pool" solution is functionally equivalent to the wearer choosing the languages, and has all the same problems as that solution. (See below.)
Finally, there's the issue of the character's own ranks in linguistics. A character may well take a rank or two in linguistics before acquiring the headband; perhaps they choose orcish and elvish. If the headband doesn't have those two languages, what happens? After all, if the headband's bonus to a skill is better than the player's, the headband's ranks replace the player's own. And so all of a sudden should the player stop knowing the languages they knew previously? Or perhaps they keep their own languages and start on the headband's languages two ranks later?
Assuming you do get the languages... but the wearer gets to choose.
Already, we have to bite the bullet here and rule that linguistics is an exception to the general rule of the headband: choices related to linguistics are the only choices the wearer gets to make. Even though the headband doesn't let you choose a bonus language for intelligence!
If the wearer gets to choose, then the GM has to rule what happens when the wearer takes off the headband and puts it back on a few days later. Do they get to make entirely new choices for the language? Or do they have to stick to the same they chose before?
Intuitively, it seems like the latter has to be the case. Being able to put on a knowledge-granting magic item, take it off for a day, and put it back on and gain knowledge that was different from what you learned before seems very cheesy. It's actually pretty reminiscent of the infamous Paragon Surge, the abuse of which got so bad that they had to make an errata that fixed the choices made by that spell to a 24-hour period.
One could argue that, since there is no explicit errata on this point, that the wearer does indeed get to choose different languages each time. After all, knowing more languages isn't terribly broken, especially if you have to spend 48 hours (24 to unattune to the headband, 24 to re-attune) to make new choices--much longer than the time required by paragon surge. Still, I don't think the grounding here is really solid and it will come down to GM fiat.
If you don't want to let the player do something like this, though, you end up having to rule on a lot of other things. If the player makes their choices and they can't change them, then you also have to rule about what happens if they find a new, better headband (do they get to make different choices this time?). If they don't get to make new choices for a new headband, then you're probably relying on the intuition that the headband "unlocks" knowledge that the plalyer would have had, had they invested ranks in the associated skills. But by extending that logic, if they later lose the headband and take a rank in linguistics themselves, they have to make the same choices they made with the headband potentially many in-game years ago, which seems annoying. (And there's still even weirder solutions: what if they decide to put a manual rank in linguistics while wearing the headband? And what happens if a year after that they lose it?)
In Conclusion
The simplest ruling you can give here is that linguistics in a headband doesn't give you the languages normally associated with the skill, based on the interpretation of "put ranks in" discussed above with respect to the debate about familiars. This is the only ruling that does not lead the GM to having to make many other arbitrary rulings down the line.
If you don't want to do that, I would suggest letting the headband grant linguistics, letting the player choose those ranks, and letting them choose the languages each time they re-attune to the headband. This isn't terribly broken, and seems to me to be the second-least arbitrary option.
But really, this doesn't matter. As a commenter pointed out, there are numerous options for using a magic item to speak and understand languages, including a helm of telepathy or a traveler's translator. On top of that, magic users have numerous options available to them: wizards and witches have access to the spell tongues, wizards can make tongues permanent with permanency for only 7500 gold, and witches and shamans have access to a tongues hex. There is no shortage of options for gaining access to language comprehension via magical means.
But it's worse than that. You will never find a headband of vast intelligence in the wild with linguistics as a skill, unless the GM puts it there. Otherwise, the only way this comes up is if a character crafts the headband themselves. But this character could just as well take the linguistics ranks themselves and give some other skill to the headband. They'd only be missing out on one skill until they craft it, which could well be as early as 3rd level.
So, this really isn't a problem, practically speaking. In my own game, I simply ruled that the character should just take "regular" ranks in linguistics, put whatever other skill they would have taken, and that sidesteps the problem entirely. (And in future games, I'm just going to homebrew some non-skill-related system for languages, so I don't have to deal with these questions ever again.)
Best Answer
First, instead of a headband of vast intelligence, I recommend the circlet of speaking (4,800 gp; 0 lbs.), which grants an animal wearing it the ability to speak 1 language yet doesn't increase the animal's intelligence. Although slightly more expensive than the cheapest headband, the circlet is, in many ways, superior if you want a talking animal that can still be trained; it neatly sidesteps the intelligent animal's language issues detailed below. That said...
Yes, were an animal to wear a headband of vast intelligence +2 et al. that animal could learn a language were its Intelligence score to have gone from 1 or 2 to at least 3
Such an animal could learn to understand a language but couldn't learn to speak. The section on Intelligent Animals says that
So the vague description above of how to teach an intelligent animal language all but says not to bother trying. Further, the most obvious way of improving an animal—taking the animal on adventures so it can gain XP—isn't an option, either, because animals, like most NPCs (cf. the feats Leadership and Squire), just don't earn XP.
Thus while the intelligent animal has the potential for language—all it would take is but 1 rank in the skill Linguistics for the animal to understand a language—, the intelligent animal lacks the ability to gain that rank. It's stuck with what it has.
However, to use what it has, the creature can employ the rules for retraining its skill ranks. By spending a paltry sum and as long as a several weeks, a creature can allocate its accumulated skill ranks differently. For an intelligent animal, this lets it put that minimum 1 rank in the skill Linguistics and understand a language.
Unfortunately, as they have no starting language, most animals are barred from using the retraining rules to learn a New Language independent of their ranks in the skill Linguistics because
Emphasis mine, and these rules make me sad. However, the DM could allow a trainer with the ability to speak with animals for 8 hours a day and who was willing to do so be an intelligent animal's language trainer. Extending the duration of a speak with animals effect from its typical 1 min./level to at least 8 hours is not impossible (e.g. a friendly high-level character's familiar that can both speak a language and speak to others of its kind, a creature with the animal domain and the pelt of the beast, feral speech a la wizard or witch). This New Language retraining, were it available, would cost the intelligent animal 200 gp and occupy both the intelligent animal and its trainer for 20 8-hour work days that must be otherwise absent of strenuous activity.1
Strangely, an animal with an Intelligence score of 1 or 2 can put ranks in the skill Linguistics, doing so through retraining as described above or just using its native skill ranks.2 The animal, however, still isn't "smart enough to understand a language," so what, exactly, these ranks in the skill Linguistics do for an animal is unclear. (Animals that are also animal companions have a skill list that prevents the animal companion from putting ranks into some skills at all.3 Such a creature can't put ranks in the skill Linguistics until it has an Intelligence score of at least 3.)
Yes, a headband of vast intelligence +2 et al. that's imbued with the skill Linguistics and that raises an animal's Intelligence score to at least 3 grants the animal the ability to understand a number of languages equal to the animal's Hit Dice.
Such languages are probably picked by the item's creator, although this isn't entirely clear. An animal wearing such an item wouldn't need to "be taught a language, usually over the course of months," nor retrain as described above. Such a creature still can't speak, however.
No, a typical thrush or typical raven (or parrot) wearing a headband of vast intelligence +2 et al. that learned a language would not be able to speak that language.
Only when these creatures become familiars do they gain the supernatural ability to speak but 1 language. In fact, only if further effects permit is such a familiar ever able to speak more than the 1 language picked when the familiar was first gained. While the familiar may be able to understand other languages (e.g. bonus languages from a high Intelligence score, its master's Linguistics skill, a headband of vast intelligence +2 et al. imbued with the skill Linguistics), the familiar will remain unable to speak those languages.
However, it's a reasonable house rule to allow a familiar with the supernatural ability to speak 1 language to speak, instead, any language it knows.
1 Undoubtedly, there's a sitcom pilot being pitched right now about a good-hearted but down-on-his-luck wizard with the arcane discovery feral speech who teaches Common as a First Language classes to wealthy, murderous cats at the local night wizards' school. Attention, Networks: I will pay real money to watch this show.
2 An animal's class skills are Acrobatics, Climb, Fly, Perception, Stealth, and Swim. Thus the animal can put ranks into the skill Linguistics, but won't get the bonus that comes from the skill being a class skill.
3 "Animal companions can have ranks in any of the following skills: Acrobatics* (Dex), Climb* (Str), Escape Artist (Dex), Fly* (Dex), Intimidate (Cha), Perception* (Wis), Stealth* (Dex), Survival (Wis), and Swim* (Str). All of the skills marked with an (*) are class skills for animal companions. Animal companions with an Intelligence of 3 or higher can put ranks into any skill."