Bring a large pot of water to a boil. Generously salt boiling water and return to a boil. Add pasta and cook according to package directions. Drain.
Meanwhile, heat oil in a medium skillet over medium heat. Add garlic, red pepper flakes, and anchovies, if desired, mashing with a wooden spoon. Cook, stirring, until garlic is fragrant, about 2 minutes.
Add tomatoes and their juices, roughly cutting with kitchen shears or breaking up tomatoes with hands. Stir in capers, if desired, and olives. Bring to a boil and immediately reduce to a simmer. Season with salt and pepper. Let simmer until thickened, 5 to 10 minutes. Add pasta to skillet; toss to combine, and serve garnish with basil, if desired.