The rules are silent on this.
In practice, I've seen it both ways, depending on whether the group takes a more gamist/metagamey approach or a more simulationist approach. "Open rules" games just have the GM tell you "that fails" if it's invalid on its face (only concealing the reason if it plays into the challenge, like "Charm Person fails... I wonder what that guy is if not a humanoid?" But in general you roll for SR, roll the save, you know why it failed. In our current Pathfinder campaign the GM runs it like this, and whenever it's in doubt a flurry of Knowledge checks fills in the gap.
In a more sim game those things are kept more "under the table" because it's not about the rules challenge it's about the in-game-world reasoning challenge. I ran a 5-year 2e campaign that worked like this.
This falls into the lacuna of other things like "do I know if I made a save vs. a spell" that is undefined so that different games can do it differently based on their desired feel.
Single use item
A scroll (6125 gp) or an item with one charge (5675 gp) is probably the cheapest solution to cast Raise Dead.
Also, you can use these items with Use Magic Device. Chances are lower than for a lower-level-than-necessary cleric, but you can retry (with 24h break on natural 1) for sure. (I'd say that - although not very clearly - retries for casting spells from scrolls are possible too). Raise Dead is not a combat spell anyway (casting time 1 minute), so the impact of several retries is not essential.
Ring of Spell Storing
More expensive option, requiring some balancing role-playing, is to give your NPC (or a temple the PCs can visit) a Ring of Spell Storing (50k gp) with Raise Dead. (Imagine a more powerful cleric recharging the ring every time she visits the temple, but not too often). The advantage of the ring - anyone can have it and use it, even if your local temple is run by a Lvl 1 Paladin (here you need the balancing act - 50k gp, powerful item is unusual in the hands of a 1st level character).
Planar Ally (long shot)
Lesser Planar Ally is a 4th level Cleric spell with 100 XP cost. A scroll is 1200 gp, a wand is 920 gp per charge. A summoned planar ally requires a payment of 100gp per HD for quick tasks, half if the task is not hazardous.
And a Hollyphant (Book of Exalted Deeds, p. 176) and a Movanic (Fiend Folio, p. 57) are 6HD, good outsiders (Hollyphant - NG, Movanic - any good) that happen to have Raise Dead as a spell-like ability. You could allow the NPC to be able to call them with Lesser Planar Ally and pay either 300gp (I don't think it's hazardous) or bargain another service for the outsider. With a scroll, the total cost is 1500 gp.
You could assume your (or the NPCs) deity will send one of these outsiders if you request help to bring someone back from the dead.
Best Answer
First and foremost: There are no rules that allow the researching of spells. The only way a wizard can expand their repertoire is via the 2 spells gained at each level or by finding spells (PHB p.114).
This leads to the simple RAW answer: No
However, you can always fall back on How to Play (PHB p.6)
My personal preference is "No, if you want to do that play a druid or cleric"
As guidance for handling this specifically, the DM can look to Changing Spell Lists (DMG p.287), Creating a Spell (DMG p.283) and Crafting a Magic Item (DMG p.128).
However, Wizards can cast death-reversal spells. They do this through the spell Wish which can emulate any 8th level or lower spell; this includes every death reversal spell except True Resurrection.