Carbon fiber composites are made up of sheets of carbon fiber filaments. These are usually impregnated with resin. To make CF structures, manufacturers will cut up the sheets, then lay them up onto a mandrel or other structure. They will then bake them at high pressure and temperature to cure the resin. The image below is from a Youtube video showing how Mad Fiber wheels are made - that company is now defunct, this is just for illustrative purposes. The metal item is a mandrel, which is a bit like a mold except that you put sheets of carbon on to a mandrel, versus you would put things in a mold.
If you have a CF frame or component and it's been damaged such that you can see torn fibers, it needs repair or replacement. The image below is from Appleman Bicycles, who is a carbon framebuilder and repairer in my city. Disclosure, he's local to me and we are acquaintances, but I'm not a customer. On the left side of the frame, the fibers are clearly broken. Here is a question where chain drop has also caused damaged fibers.
Imprints (may be called witness marks) on the steerer can form from a loose headset. We should all periodically inspect our carbon forks. One example is below, from this question. My understanding is that this is repairable, that it isn't a complex job, and that it's not very costly (source Raoul Luescher, Escape Collective Discord). Contact your local repairer. If they can't do it, I'd seek a second opinion; the repair techniques should have spread through the industry, but not all repairers may know them.
Last, the bike below finished Unbound Gravel in 2023. There was a very high-attrition mud section on the course. Note the concentric rings in the abraded section - the mud abraded through several layers of carbon. This is another visible failure. Again, this needs repair for sure. However, it is repairable.
What to do if uncertain: a proposed set of steps for consumers
The above cases describe visible damage. This section concerns what to do if you sustain an impact that doesn't leave obvious damage. This is a harder question.
Damage to carbon items is frequently not visible at the surface. However, an impact, even a fairly soft one, might lead to a delamination below the surface that later grows into a larger failure. Delamination is the CF term of art for a fracture.
Ultrasound or other imaging is used to inspect CF parts in the aerospace industry. Ideally, we would have this capability widely available, but we do not. This is the only reliable way to detect a delamination under the surface. There may be a carbon repair shop close to you with this capability, but your local bike store cannot do this. Many people will propose a tap test, where you tap a coin lightly around the suspected fracture and listen for a change in pitch. Raoul Luescher says that this test can work on flat surfaces of constant thicknesses. However, bikes have a lot of curvature and varying thicknesses. Rob Granville of Carbon Bike Repair concurs, with a video demonstration. If you do try this, you are listening for a marked drop in pitch.
Otherwise, I would propose watchful waiting for lighter impacts where you can't see damage. Be familiar with how your bike sounds and how it flexes under your pedaling. If you notice a sudden change, stop riding and try to see if there are any cracks. They may be small. If you had a heavy impact, e.g. car vs. bike, I would lean more towards finding a repairer to inspect.
One example of a small fracture is below, picture from a video by Raoul Luescher, a carbon bike repairer based in Australia. Here, a metal part associated with the steering system hit the bike's head tube from inside due to arguably poor design. There was a small visible crack from the outside.
Alternatively, Carbon Bike Repair shows an aluminum bottom bracket shell coming unbonded from the frame, possibly due to repeated thermal expansion and contraction of the shell (whereas carbon exhibits much less thermal expansion). You might see a ring of cracked paint around the circumference of one side of the shell, and if you applied force through the cranks, you could probably see the crack flex (this may be aided by a smartphone camera + magnification).
I believe that paint chips around frequently handled parts can be ignored. These might include areas around the dropouts. Gravel bikes may frequently take paint chips from flying bits of gravel. Some examples of what I believe to be paint chips are below, taken from recent posts.
In contrast, the image below shows actual damage. If you look closely at the chip, I believe you can see some broken fibers. The owner had this inspected and repaired.
Carbon repairs may not be that that expensive compared to repairing metal frames. On metal frames, damage will frequently involve replacing the entire affected tube. In contrast, with carbon, the second photo from Appleman bicycles shows that repairs can be localized to just the damaged area. The repairs may not be cheap compared to purchasing a new frame; sometimes, companies may be willing to extend a crash discount to customers.
I believe that forks, wheels, stems, and handlebars are not cost effective or possible to repair (aside from the ring of death above). This was reported by some carbon repairers who have appeared on podcasts like the old Nerd Alert (Cyclingtips, now defunct) or the Marginal Gains podcasts. There's no harm asking a repairer near you, but you should prepare to replace these components if damage is suspected. Many premium wheelsets are starting to come with free crash replacement guarantees for the original owner. Otherwise, manufacturers typically reserve some rims and other spare parts for warranty and repair cases.
In addition, if a major frame tube gets broken all the way through, I'm not sure the frame could be trusted even if repaired. Josh Poertner and colleagues on this Marginal Gains podcast discussed this starting around 22:50. I believe they said that seat stays, which are lightly loaded, can be repaired even if broken through. I am not sure about chain stays.
A note on handlebars and forks
If you crash or drop a bike, by virtue of their position, the handlebars are likely to take an impact. In contrast, it is unlikely that you will hit a carbon crank but not the handlebars. In the case of head-on collisions, you can assume that the fork has taken a hard impact as well.
If a handlebar or fork fails under load, you are extremely likely to crash. It may be worth being more conservative with these parts if they're made of carbon, and leaning towards replacing them if damage is suspected. In fact, it may be good advice to replace these parts regularly. I realize that this is easier said than done, and I am not aware of empirically-backed replacement intervals for these parts.
For many frame tubes, if one tube fails under load, a skilled rider can often come to a controlled stop, and there is some degree of redundancy if the tube is a chainstay or seatstay.
Some notes on prevention
My understanding is that CF does especially poorly under point loads - i.e. getting hit by a small hard object. While this is easier to say than to do, users can consider all the scenarios where hard objects might hit the frame and try to mitigate them. In this question, the poster packed their bike in a bag, but the fork rotated and the rim brake caliper hit the frame. While the solution would again be watchful waiting, it's worth trying to avoid such things happening. For example, if packing a bike, one could try padding the rim brake calipers or otherwise not pack hard objects in the same case.
A side note: minor surface damage inside the frame
As I discuss on another answer, frame manufacturers designing for high-level competition obviously push frame design. There may be cases when a carbon tube is flexing against a metal item. For example, in late 2021, Specialized recalled their Tarmac SL7 frames and forks. The headset had a compression ring on the outside of the fork steerer. As the bike hit bumps, the compression ring had an relatively sharp edge that dug into the steerer tube's surface. This would eventually cause a failure. However, Raoul Luescher raised an issue with the fix, namely that now the compression plug, which was cut to length, could have a sharp edge as well. He showed a borescope shot of the inside of the fork where the edge of a compression plug marked the surface of the fork, and he argued that this is likely to fail eventually. For performance road bikes with hydraulic hoses routed inside the steerer, an unexplored issue is that over time, the hoses might abrade through the steerer tube's fibers as well.
The watchful waiting advice applies to damage from one-time events. The issue of damage from repeated events is a more serious one. However, this sort of damage is likely to happen outside your line of sight, and it might require specialized tools to even see.
Raoul Luescher (Australia) has a YouTube channel. He typically discusses engineering issues and shows cut-up frames and components. I don't remember him showing his repair process, though.
Carbon Bike Repair (UK) also has a YouTube channel. They show damaged frames, and select shots of their repair and repainting processes. They're a good channel to see examples of what carbon damage looks like.
This Marginal Gains podcast features a Q&A with Shawn Smalls of Ruckus Composites (US).
This is a Nerd Alert (part of Cyclingtips, now defunct) podcast with Ruckus Composites and Raoul Luescher. The parent company has been restructured, and I'm not sure how persistent this link will be. However, this podcast was stored off-site (and may still be available on regular podcast apps).
This Ruckus Composites video shows a bike with damage to a section of the top tube. They showed the results of the tap test, and they also showed how they do and interpret an ultrasound scan of the area.
Moving on to forks, Mike Lopez, who says he worked on the Reynolds Ouzo Pro fork around the late 90s or 2000s, comments on the Paceline forum on how they decided on test protocols and tried to think about how they could simulate real-world use.