Yes, the player with the Alert feat cannot be surprised, but this doesn't prevent surprise.
- If the player character rolls an 20 on initiative and the enemy rolls a 10, does the player get to attack first?
The player with the highest initiative always goes first. Surprise does not change where each combatant takes turns in the initiative order, but it may change what you can do on your turn.
- Or should the enemy get to fire the shot before initiative is rolled?
If an enemy is attacking, surprise has already been determined, positions have been established, initiative has been rolled, and the enemy's turn has come up in the initiative order.
- Or should I have the enemy roll initiative first and be able to fire a shot, and only then have the player roll initiative?
No. Everyone rolls initiative at the same time.
With the Alert feat,
- You can’t be surprised while you are conscious.
- You gain a +5 bonus to initiative.
- Other creatures don’t gain advantage on attack rolls against you as a result of being hidden from you.
According to the section "The Order of Combat", step 1 is "Determine surprise". Since it says:
A member of a group can be surprised even if the other members aren't.
The player with the Alert feat cannot be surprised, but the rest of the party may.
If we have two sides, say goblins versus the party, and the goblins gain total surprise (no party member is aware of the goblins), you still follow the Order of Combat:
- Determine Surprise
- Establish positions
- Roll Initiative
- Take Turns
- Begin the next turn
At step 4, each combatant takes a turn in initiative order. On the turn of a surprised combatant, the following applies:
you can't move or take an action on your first turn of the combat, and you can't take a reaction until that turn ends.
In this example, the player with the 20 initiative goes first. However, since the player has the Alert feat, they are not restricted as they are not surprised. If they had a Weapon of Warning, the same would apply to any ally within 30'.
The player has the higher initiative, and is not surprised, so may act, but against what? There is nothing in the Alert feat description that grants the player knowledge of the enemy. At this point, you could surmise the player knows "something" but it simply isn't detailed. I would suggest what they know be something nebulous, like a feeling of being watched or danger, rather than adding information the player should not have access to. The player could use the Ready action to attack the first perceived enemy, but in any case, if the player does not hear or see the enemy, they have nothing to target. According to "Unseen Attackers and Targets":
When you attack a target that you can't see, you have disadvantage on the attack roll. This is true whether you're guessing the target's location or you're targeting a creature you can hear but not see. If the target isn't in the location you targeted, you automatically miss, but the DM typically just says that the attack missed, not whether you guessed the target's location correctly.
So there's nothing stopping the player from attempting to attack by guessing a location.
The player could, however, notify the other players*, move to a better position, take cover, dive to the ground, drink a potion, cast a spell that doesn't target the enemy, or take any other action, but attacking seems unlikely to succeed on their first turn in the initiative order.
*Whether or not this means the other members are no longer subject to surprise restrictions is up to your DM. Surprise does mention
Any character or monster that doesn't notice a threat is surprised at the start of the encounter.
Since they did not notice an enemy at the start of the encounter, alerting the other players may not provide any benefit. On the other hand, one could argue, they now are aware of the threat.