Hi Midger….. and welcome to Ribnet!
Everything everyone has said above is right but the radio side of it might be somewhat puzzling to someone that hasn't done their VHF exam or who hasn't got a VHF radio despite hours in a boat. I feel particularly well qualified to answer your OP having had to put out two pan-pan calls in as many years. I even got an award at the belated Ribnet Xmas dinner for the last one that I made
Although waving arms up and down, shouting, flying flags, burning barrels of tar etc may work in a harbour, these (apart from the barrels of tar which aren't that practical on a RIB!) rely upon someone being around to see you but if you are going outside a harbour (and even inside if it's a big one) you should have a VHF radio. This can be hand-held (max 6W transmission power: couple of miles distance) or fixed (max 25W transmission power: as much as 10 miles or more) and should be tuned to monitor Ch16 (although you can set it to monitor other channels as well at the same time). You can then tune it to other channels to talk to other people once you've established contact with them on Ch16.
With everyone outside the harbour (theoretically) therefore listening to Ch16 at the same time, they should all be listening if you put out a call on that channel. Apart from using the channel to call up someone you know (and then switching to an agreed alternative working channel) a call on Ch16 announcing that you are in trouble should be heard by everyone within range.
Your call can be a 'Mayday' (after the French: m'aidez - help me) which should only be used where there is grave and imminent danger to you, the boat [or some other important object] and you require immediate assistance. The call is made according to a set formula and I (along with many others) have it printed out and stuck on the console so that, if needed, it can be read without thinking overly in situations of stress.
Trouble in situations that do not warrant a Mayday call are covered by a Pan-pan (after the French 'panne' - breakdown, rather than 'pain' - bread). This is less formulaic but still requires specific details and is broadly in the same form as the Mayday.
Either call is likely to be answered by the CG although in the absence of a response after four minutes any station may answer either directly or by way of a 'Mayday relay' (see your VHF course for more details).
The CG will then ask for assistance to be given by any other vessel in the area able to help (by way of tow, petrol, spares, more tar for the burning barrel etc) but failing this (or additionally) will task the RNLI or other appropriate resource.
You then wait whilst taking what action you can to make the best of a bad situation: put the anchor down to avoid drifting into danger, try to mend the electrical fault, throw the wife overboard to lighten the load etc.
If a stranger gets to you first, agree the terms of the rescue (most help for free on the basis of 'there but for the grace of God' or 'karma', but beer or cash are both good incentives) and if it is the RNLI (and there are other volunteer organisations out there), a suitable donation is considered appropriate.
You can, however, avoid all the above by (1) keeping you engine regularly maintained and serviced (2) investigating anything that goes wrong (no matter how small) (3) knowing your boat (4) training your crew (5) acting sensibly by checking weather, tides, sea state and equipment, assessing the ability of both you and your crew and not being afraid to say 'No' or turn back.
(Oh ….. and also checking how much fuel you have left in your tank!
Sorry that the above is somewhat wordy but it is a subject dear to my heart and is made with thanks to those that came to my help on each occasion that I asked for it and, hopefully, my own reciprocal help to those requesting it has been appreciated.
Good luck with the VHF and let me know if you're out any time between Weymouth and Cowes.