As Dewald says, you need to set it in the menu, BUT you also need to increase the chance of it happening, or I don't believe you will see it happen otherwise (unless you drive for hours at a time).
Are you asking about AI or the player?
For the AI, if you look in the engine.ini file there are two lines that can be edited to change the chance of mechanical failure.
Example: in the F_V12_engine.ini
LifetimeAvg=14400
LifetimeVar=3600
So the average lifetime of the engine (per session) is 14400 seconds (4 hours)
with a variation of 3600 seconds (1 hour).
I'm not sure if there are any other variables in the calculation, but if you reduce the lifetime to 3600 and the Variation to 1800 or even 2700, you are far more likely to see some failures.
Using this method, the reason for mechanical failure shows up in the results log as Gears, Brakes, Engine or Susp. I believe this reason is chosen at random.
I don't think the player is affected by the above but I'm not 100% sure about that.
Player mechanical failures are also possible in the engine.ini but not quite so easy to create.