The ending of The Conjuring 2 turns on a name: Lorraine commands the demon with the word Valak, which breaks its hold on Janet and on the house. Everything below gives away the ending, and the reading of it is my own opinion.
In my opinion, the smartest decision in the film is that the old man was never the real threat. Bill Wilkins is a front, and the nun is a stronger demon that has been hiding from Lorraine and blocking her gifts. That gives the creature a clear rule: it works through disguise and through misdirection of the one person who could name it. It also explains why the Warrens walk away after the case is publicly discredited, because the film makes them lose their certainty before it hands them the answer.
The vision from the Amityville séance pays off in the final act. Ed saves Janet from the window and is nearly impaled on a broken tree stump that matches what Lorraine saw. It could be argued that the film plays with the promise of that vision rather than simply delivering it, since the audience spends the second half expecting a death that does not arrive. Ed survives, the Hodgsons are reunited, and the haunting ends.
The last beat is back at the Warrens' home, where Ed adds a haunted Crooked Man toy to their collection of cursed objects, next to the Annabelle doll. That shot sets up the later spin-off films about the Nun and gives the saga another monster to use. Perhaps the most telling detail is that the nun was not the original plan. The antagonist was first conceived as a winged demonic figure and was changed to a nun in additional photography in March 2016, according to the production record. In my opinion, the nun became the saga's most reusable monster, and The Nun (2018) followed two years later.
Is The Conjuring 2 really scary? That is a matter of taste, but in my view the Demon Nun is the film's best creature design, because her scenes depend on stillness and framing more than on noise.