Bastila Shan is a human Jedi, born on Talravin to Helena Shan and a treasure hunter, and given up to the Order by a mother who did not think a life of expeditions was suitable for a child. She was created by BioWare for Star Wars: Knights of the Old Republic (2003), written in part by David Gaider, and voiced by Jennifer Hale.
Battle meditation
Her gift is battle meditation: a Force discipline that lifts the morale and coordination of an entire allied fleet while collapsing the enemy's. It makes her a strategic asset rather than a soldier, which is the source of everything interesting about her — she is a young woman who has been treated as ordnance by her own side since she was old enough to understand it.
The Sunrider connection
She very nearly was somebody else. The character was originally conceived as Vima Sunrider, to connect the battle-meditation lineage back to Nomi Sunrider in Tales of the Jedi; the name went through "Sareth Dorn" before landing on Bastila Shan, reportedly over trademark concerns around "Sunrider". The inheritance survived even though the surname did not.
The bond
Shan keeps Revan alive on the bridge of a dying ship, and the act creates a Force bond between them. She then persuades the Council that the bond can be used — that Revan's buried memories can be drawn out and turned into a weapon against the Sith. She is, in other words, complicit in the central deception of the game, and the story does not let her off it.
Taris and after
Darth Malak orders the destruction of an entire ecumenopolis rather than let her escape it, which is the game's efficient way of establishing both what she is worth and what he is. Later he captures her and turns her, and the confrontation on the Star Forge — a fallen Bastila against a Revan who is remembering — is the emotional climax rather than the boss fight that follows.
Afterwards
Drew Karpyshyn's The Old Republic: Revan (Del Rey, 2011) makes the marriage and the son canonical within Legends, and establishes the Shan line that runs down to Satele Shan three hundred years later — one of the very few multi-generational family threads Star Wars has built entirely outside the Skywalkers.
Why she works
Because the writing gives her a real flaw rather than a decorative one. Shan is arrogant, brittle, and frightened, and all three are direct products of being raised as a strategic resource. Two decades on she is still the best-written companion character in a Star Wars game.