What happens at the end? I watched it a few times but I don't understand it. Was it just a dream?
In an interview with the writer/director JT Petty, he explains that the burrowers, creatures who lived underground and came out periodically to feed, were "basically part of nature. Like if white people didn't show up, they would have kept on their feeding cycle, and everything would have been fine. They come up every 30 years or so; and they came up one time and all the buffalo were gone." So they had to find another warm mammal to eat, and what they found were the people who had slaughtered all the buffalo.
In researching for his movie, Petty discovered that 40% of cowboys in that time were black, and the majority of the rest were immigrants - it wasn't a job anyone wanted. So the inability of people to communicate with each other leads to a lot of mistrust and bad assumptions, which sort of drives the film, and reinforces the underlying message of our historical lack of understanding and subsequent assumptions with regards to Native Americans, a tendency which perhaps persists today with regard to other cultures.
At the end, just when the Irishman is about to learn the secret from the Indians for how to kill the beasts, the Cavalry arrives "misinterprets the situation and ruins their chances of success...Where misunderstanding piles onto misunderstanding and causes everyone to get f**cked."
While the soldier brags about killing the Indians, the Irishman (Fergus Coffey, played by Karl Geary), stares off into space, reality dawning that their only hope of survival is hanging from a makeshift gallows. It is a desolate ending suited to the horror genre!