Used to be that RAW, the sniper wasn't getting the sneak attack. Why? No good reason other than that "a legalistic reading of the rules said so." There are no end of huge threads on paizo.com going over in tortuous detail how vision and stealth and all that work in PF core, especially here and here, and the summary was "slavishly following the rules means things that make no sense." You never get sneak attack from stealth because "you can't stealth while attacking" and "it doesn't say you get sneak attack just because someone can't see you, as hidden isn't an official condition (tm)."
I would previously invoke GM privilege to implement RAI - as in Pathfinder they say clearly "the GM is the law over and above the written rules" - and make it so they get their sneak attack. Because it makes sense from a game world logic/sim point of view and you can rule that's more important than the RAW point of view. IMO the clear intent was to sneak-attack someone from Stealth. You know, "sneak," "attack," things that happen in the real world and every previous edition of D&D.
Can I Attack From Stealth?
Now, however, the Stealth rules have been errata'ed to specifically say "you can attack from stealth" which means that yes, you get the sneak attack. See the updated version on the PRD which says:
Breaking Stealth: When you start your turn using Stealth, you can leave cover or concealment and remain unobserved as long as you succeed at a Stealth check and end your turn in cover or concealment. Your Stealth immediately ends after you make an attack roll, whether or not the attack is successful (except when sniping as noted below).
Sniping: If you've already successfully used Stealth at least 10 feet from your target, you can make one ranged attack and then immediately use Stealth again. You take a –20 penalty on your Stealth check to maintain your obscured location.
So the RAW has been updated to match the RAI for whatever that's worth (apparently it's really meaningful to some, though all my rogues have been happily sneak attacking from Stealth since the year 2000...).
Does A Stealthed Attack Enable Sneak Attack?
Yes, if you're stealthed, your attacks are sneak attacks.
Jason Buhlman states the intent clearly on the Paizo forums:
For simplicities sake, it should be assumed that those making Perception checks get to do so at the most favorable point during the movement of a character using Stealth, to avoid making checks every time the condition changes. Technically, I think you would get a check whenever the conditions change, but that might make things overly complicated during play.
Creatures are denied their Dexterity bonus to AC "if they cannot react to a blow" (CR pg 179 under AC). It was our intent that if you are unaware of a threat, you cannot react to a blow. I think we probably should have spelled this out a wee bit clearer, but space in the Stealth description was extraordinarily tight and ever word was at a premium. That said, I think these changes clear up the situation immensely (compared to where they were.. which was nebulous at best).
They didn't bother changing the RAW because most people use common sense and play it that way. Stealthed = sneak, etc.
RAW + Pathfinder = Sad Panda
This is why, whether you like this or not, a pure RAW approach to Pathfinder is always going to be frustrating; the devs explicitly don't bother to clean up RAW when RAI and/or common sense is clear. It's not a priority of theirs and I for one am pretty happy about that - they spend their intellectual capital making new interesting fun content instead of crafting rules and just retreading the same content year after year like WotC did with 3.5 (Return to the Return to the 1e Module, anyone?).
The archer gets visible after the first shot. So only the first one is a sneak attack.
But for example, if you have a higher initiative result at the beginning of an encounter, your foe is flat-footed and every attack you make is a sneak attack. The same is true if you flank your foe in melee.
Sometimes, you make multiple attacks with the same attack roll, such as when you use the Manyshot feat, or you make multiple attack rolls as part of the same attack, such as with the scorching ray spell. When you do so, only the first attack in the volley can be a sneak attack.
Best Answer
Invisible creatures can be spotted more than 30 feet away.
The rules in Rules Compendium are (mostly) compatible with the the base rules in the Hide skill:
The Rules Compendium does seem to empower invisibility, asserting that noticing an invisible creature "gains a hunch that 'something's there' but can't see it or target it accurately with an attack" where the Spot skill says that a high enough roll "lets you become aware of an invisible creature near you, though you can’t actually see it" (this GM's reading is that the spotter would know the square(s) that the invisible creature occupies, but they would still benefit from concealment). It also adds a 3rd state for the invisible creature: one that "is holding still is very hard to notice (DC = ... Hide check +30)" and suggests that only "inanimate object[s] or ... unliving creature[s] holding still" get the +40 bonus (which this GM has always read as applying to living creatures who are simply holding still).
Regardless, an invisible creature can be spotted by mundane means from more than 30 feet away (though, remember that there is a cumulative -1 penalty on Spot checks for each 10 feet of distance between the spotter and the thing being spotted; similar for Listen checks).
Interestingly, neither the Rules Compendium, the invisibility spell, or the base Hide, Listen, or Move Silently rules actually give any mechanical indication that the invisible creature's location is given away by sound; being incorporeal isn't relevant to a creature's Hide skill (aside from the fact that being incorporeal allows them to hide inside of objects, which probably helps).
The only sensory information inherent to being incorporeal is:
Being incorporeal doesn't affect your ability to use Hide to prevent someone else from being able to Spot you. This is backed up by the first line of the Spot skill's description:
Being silent, while helpful for avoiding detection generally, doesn't affect your ability to remain unseen; it doesn't factor into your Hide check, nor does it adversely affect the Spot check of someone who wants to see you, no matter the distance.