Lets say I want to ev train a ralts. I give it a macho brace and I enter a battle. If I switch out that ralts then faint the wild Pokemon, would ralts still get the double ev yield or no?
Yes, what matters is the Pokemon participation in the battle. So, in the case of you switch out the Pokemon holding a macho brace, it will still yield double EV.