I have been having a problem with my 1994 318is with M42 engine.
Intermittently, if the car is hot, it won't start. All the lights come on, but there is no turning of the starter motor at all. When this happens the starter interlock relay under the dashboard makes a screeching noise.
Weird thing is this happens not just if the car has been driven and the engine is hot, but sometimes just sitting outside on a hot day.
So I replaced the starter interlock relay but still the fault remained.
Over the next few months the problem worsened and happened hot or cold, and only intermittently.
The problem turned out to be the ignition switch. I pulled it apart and cleaned it rather than replacing it and the problem was fixed.
Then to be sure I bought a used part and fitted it and haven't had the problem since.