In X-Men: Apocalypse (2016) at the very end of the movie, while they are showing the newly assembled X-Men in a brief Ewok celebration, there appear several metallic robots. What are those and why are they in that scene?
The scene at the end of the movie is showing the rather famous X-Men "Danger Room"; we have not seen very much of it in the movies, but it appeared in a regular basis in the source comics, especially early on.
The robots were Sentinels, as you can read about in this question, who are programmed to attack mutants. The purpose of the Danger Room is to train X-Men to fight against life-threatening foes in a controlled environment. The "threats" in the danger room, most of the time, are not real. They are created by Professor X to simulate real-life threats the X-Men might face. As such, it's likely that the Sentinels are just copies of, or even holographic/virtual projections of, actual Sentinels.
The point of the scene was to show that Xavier had finally decided to accept what Raven and Hank had been telling him -- that his school needed to be more than just a place to educate mutants. He needed to train them to fight, and become X-Men.