If I fire a bunch of Friend-or-Foe missiles when I'm leaving a station will they target npcs and neutrals, or only available hostiles?
If there are no valid targets, what happens with the missile?
Will it go after an NPC station or jump-gate?
According to Eve University:
When activated, they will fire on the nearest hostile (ship/drone which has aggressed you).
So no, they will not target neutrals. Just targets that are attacking you.
They only target what you'd want them to target (hostiles) not friends and not structures.
Have used thousands of FoF cruise missiles both in fleet and solo doing level 4 missions in high-sec. They have a niche that works very well for some missions due to their extremely long range and (possibly a change because different than the Eve-Uni listing) their explosion radius is almost half what the cruise cousins (means good for small targets). When you get those missions with a large number of scrammers with dampers and possibly jammers (meaning you either cannot target or can only target ships very close) then FoF are one of the answers, and the one I like.
There are some ambush missions that drop you in the middle of very high dps. I use a MWD or MJD, then FoF missiles for their range. Despite the much lower damage listing their explosion radius results in net damage near the tech2 version of cruise missiles.
Many people, possibly biased against the old AI (now replaced) of FoF missiles repeatedly deny their use. I find them a Godsend.
Some good information from EvE Uni
Auto-Targeting (previously referred to as Friend or Foe (FoF)) missiles, found under 'auto-targeting' in the market menus, are missiles which don't rely on locked targets in order to fire. When activated, they will fire on the nearest hostile (ship/drone which has aggressed you). Auto-Targeting missiles will only activate successfully if there are suitable targets within range. Auto-Targeting missiles will not fire if there are no suitable targets within range, and they cannot be run "hot" in preparation. Auto-Targeting missiles will not fire on a cloaked ship. Auto-Targeting missiles will fire on a decloaked ship if it previously aggressed you, without waiting for them to re-aggress. There are only Auto-Targeting versions of the three guided kinds of missile -- light, heavy and cruise missiles -- which can be loaded into their corresponding launchers. Each version comes with the usual four different warheads for four different kinds of damage.
Auto-Targeting missiles have the same flight characteristics and explosion profiles as their normal cousins, but do a bit less damage. Auto-Targeting missiles are rarely useful, but they can help if you can't target because of ECM jamming or (more rarely) sensor dampeners, particularly if you only have a few enemies (the fewer enemies you have, the better the chance that your Auto-Targeting missiles will hit the one you want them to hit).
http://wiki.eveuniversity.org/Missile_Launchers#Friend_or_Foe_Missiles