I always worry about cleaning my engine bay in case of water getting in places it shouldn't and shorting something.
If I'm cleaning an engine bay with an open filter like the ram air one above then I wrap a carrier bag round it.
Other than that I make sure the engine is hot. I don't leave it running while cleaning.
I give mine a good spray with neat non caustic tfr. Give it 5-10 mins to work its magic then jet wash off. Pull bag off the filter. Start that car and shut the bonnet so it drys slightly then give it a light spray with auto glym tyre dressing and leave that to dry. You get a good shine with that without leaving much residue.
I've done the above and made 15 year old engine bays look as new.
Never had any issues with water getting in electrics or anything. That was more of an issue on older motors with dizzy caps etc