Why did Brigid kill Archer?
Brigid O'Shaughnessy wanted to get rid of her boyfriend Floyd Thursby because she didn't want to share the profits from the sale of the Maltese falcon, when she received it from Captain Jacobi, with Thursby. She went to Sam Spade with a fabricated story intended to get a private detective to follow Thursby and hopefully either scare him into leaving San Francisco or else to get into a shootout with the detective which would either get him killed or else jailed on a charge of murder. Miles Archer volunteered to follow Brigid and Thursby that night. But Thursby didn't get frightened into leaving town and didn't confront Archer. So Brigid used a revolver she had either borrowed or stolen from Thursby to shoot Archer in the blind alley. She knew that Spade would tell the police that Archer was following Thursby and that the police would assume Thursby was the one who had killed Archer, especially when they learned that he had a long criminal record. This would either force Thursby to flee from San Francisco, or else it would get him arrested for murder. In either case, Brigid would get rid of him and keep whatever money she could get for the falcon when she received it.
This is how Sam Spade explains her motives and behavior in the last chapter, titled "If They Hang You," when he is accusing her of killing his partner Archer:
"You thought Floyd would tackle him and one or the other of them would go down. If Thursby was the one then you were rid of him. If Miles was, then you could see that Floyd was caught and you'd be rid of him. That it?"
"S-something like that."
"And when you found that Thursby didn't mean to tackle him you borrowed the gun and did it yourself."
What Brigid didn't anticipate was that Thursby would get shot by Caspar Gutman's hit-man Wilmer Cook the same night that she killed Archer. When that happened she realized that she was in serious trouble because Gutman would be looking for her--and she had to stay in San Francisco until Captain Jacobi arrived aboard La Paloma and delivered the Maltese falcon to her as promised. So she went back to Sam Spade because she needed someone to protect her from Gutman and Wilmer. Thursby had been her protector, and Gutman had him killed to deprive her of that protection and frighten her into giving the falcon to him, as he had paid her to do before she double-crossed him.