In a large broiler-safe skillet, heat oil over medium-high heat until shimmering. Add sausage, if using, and cook, stirring often with a wooden spoon to break into small chunks, until browned, 5 to 7 minutes. Transfer to a bowl using a slotted spoon; leave drippings in skillet. (If not using sausage, proceed directly to Step 2.)
Add onion to skillet and cook over medium heat, stirring often, until softened, about 5 minutes. Add garlic, tomato paste, Italian seasoning, and crushed red pepper and cook, stirring often, until garlic is fragrant and tomato paste has darkened in color, about 2 minutes. Stir in crushed tomatoes, beans, salt, and reserved sausage, if using. Bring to a simmer over medium-high heat, then reduce the heat to medium-low to maintain a simmer and cook, stirring occasionally, until the sauce is slightly reduced and flavors have melded, 5 to 10 minutes. Remove from heat.
Meanwhile, set oven rack to upper-middle position, about 6 inches from top, and preheat broiler on high. Dollop the top of sauced beans with ricotta, then sprinkle evenly with mozzarella and Parmesan. Broil until cheese is bubbly and lightly browned, about 5 minutes. Garnish with basil and serve with bread, if desired.
