Use a drywall knife to scrape off the loose parts of the existing textured surface. Use a paint scraper to take the remaining surface down to bare, flat plaster or drywall. You should take off the existing texture as far back as necessary to get to a solid surface.
Dab textured paint onto the wall in the first scraped-out area, using the drywall knife to apply it thickly over the whole span you scraped flat in Step 1.
Use a trowel to work the textured paint, mimicking the existing surface. How you do this will depend on the nature of the existing texture. If it's in a series of small, random peaks, press the surface of the trowel into the paint and pull it straight down. If it's random lines set into the plaster, set them with the edge of the trowel. If it's a swirl pattern, set the trowel in the plaster and swirl it.
Repeat this procedure for each area of the wall that you scraped out. Look at the work from a distance frequently as you're applying the textured paint to make sure the new texture is blending in with the old.
Let the textured paint dry overnight.