There are many possible reasons why your paint is peeling. The answer depends on how extensive the peeling is and what type of paint was on the ceiling before it was painted and what type of paint was used 2 years ago.
Water is the number one cause of peeling and it doesn't have to show any major signs. Possible ways that water can affect your paint job are excessive humidity in the home or room and over use of an air conditioner during humid weather. Other than a water mark, the only other way to tell if water is involved is to look at the area underlying the peeling paint. Is it discolored or showing signs of mold?
If it isn't water, then the other possibilities are surface contamination interfering with the new paint, latex paint applied over oil base or the use of cheap inexpensive paint. All of these possibilities can be combined with high humidity and cause peeling.
The only way to repair the damage is to remove the loose paint and prime the area(s) with a quick drying oil based primer. The areas can be sanded to blend the rough paint edges with their surroundings if your ceiling has no texture. For textured ceilings use either spackle or drywall mud over the areas, sand smooth and retexture to match existing. All repairs need priming before painting.
The need to repaint depends on the extent on the peeling paint and if you have any left over paint for touch up. You don't have to repaint if this is a singe small area and you have the paint.