To understand the ending of Upstream Color, you really have to understand the whole movie first. The unique thing about Shane Carruth's odd love story (which is also one of the best movies on Netflix right now) is that nothing in the movie is a metaphor–everything that happens is literal. It's just…not entirely explained in the movie.
In a nutshell, the two main characters, Kris and Jeff, are infected with a parasite that intermittently lives in humans, orchids, and pigs. As Carruth himself explained it, "There is the worm-pig-orchid life cycle, and each of these have characters that are continuing to perform these little tricks in nature that keep the cycle going, but none of them know that the next one in the line exists."
So in the worm-pig-orchid life cycle, the timeline goes like this. The Thief infects people with the parasite to brainwash them and steal their money. Once he's got his money, the Thief transfers the parasite to pigs so his victims don't die. The pigs are watched over by the Sampler (the pig guy), who can see the lives of the Thief's victims through the pigs. Each pig is still connected to the person their parasite used to live in, and the pigs' lives affect their human counterparts' lives. That's why Kris and Jeff are so messed up throughout the movie–they're experiencing the pigs' mood swings and don't realize it. When the pigs die, the Sampler dumps them in the river, and the parasite moves into orchids, which the Thief then buys to make his brainwashing stealing drug, continuing the parasite's life cycle. All the people in the chain are sort of unwitting accomplices that help the parasite survive without knowing it.
At the end of the movie, Kris and Jeff start to sort of piece together what's happening. Kris kills the Sampler, thinking he's the guy who ruined her life. They find the Thief's files on his victims and mail them out to the right people, and then they all show up at the pig farm and find the pig that's connected to them. The end, pretty much.