Why could Shirou use Rho Aias? In the UBW final battle, how come Shirou could use Rho Aias? Archer mentioned it was from the Trojan War (probably learned it while working as a counter force), but Shirou hadn't seen Rho Aias yet (not even when Archer used it).
According to the World Material FAQs from fate/complete material III with Nasu (p.130) reated to the VN:

Q: In the end of the Rin route, was it Shirou that projected Rho Aias in the Shirou vs Gilgamesh fight? Or was it Archer? In Fate/side material, it's said that it was projection magic from Archer, but in the story, there was the depiction of Shirou &quot;pulling the shield from the hill&quot;. Does this mean that this switched to Archer's scene?
A: This has been easy to misunderstand, but the part about Archer supporting Shirou was the time before Shirou pulled out Rho Aias, before Shirou came to his realization.
After Shirou's monologue about his surprise that he was still alive after taking Gil's attack, &quot;If I survived, there must have been a reason why I survived. But that was simply something I didn't have any control over.&quot;
That was the &quot;Rho Aias&quot; that Archer made to help Shirou in a way that wouldn't let Gilgamesh know there was someone else waiting to ambush him.

In other words, the first Rho Aias that defended him (as he was chanting UBW, it's difficult to project something like that at the same time) against Enuma Elish was project by Archer (EMIYA).

The original has 7 petals, this one has 5 in the 2015 ufotable anime.

The second one inside UBW was probably one copied from Archer's version (perhaps drawing from the experience that flowed into Shiro as they clashed). It's not clear how many petals was in this version (likely 4 petals, like in the Heaven's Feel path). This part was never really clarified, but you can compare it to Kuro's projection of it using the Archer Class Card from Prisma Illya.

Note that against Lancer, Archer had to muster almost all of his prana to project a 7-petal version. Since he didn't have the prana for another 7-petal projection, he probably summoned a lesser projection in order to protect the Shirou and what reserves he had left.
Rho Aias not being a sword (being a shield), is going to cost more prana to summon. Since the UBW reality marble was not up, it's unlikely that Shirou had the means to to summon it at the time. So it's more likely that it came from an external entity (Archer).
The Fate/side material encyclopedia on Rho Aias (p.78-79) states that:

The Rho Aias that protected Shirou's spellcasting during the finale of the Rin route was not something he projected himself, but was actually made by Archer who was watching the battle from a distance.

Shirou mentioned that he was able to project it by pulling it out of the &quot;hill of swords.&quot; This is likely a metaphor that refers to his reality marble (a materialization of one's inner self) or the collective of Archer memories, and not a literal hill.