Oh, dear. sorry to hear that your internal hard drive on your imac has failed. I hope you had a backup done, and a backup system in place and working. This could be kinda tricky, Glenys, but it is possible. You would have to have the External Hard Disk connected to your iMac. You would have to pick Internet Recovery. If your internal hard drive has totally failed, that'd mean there's no Recovery Partition to recover from. You can get to Internet Recovery by rebooting and holding down the Apple (command) key, Option and R on rebooting, and making sure you have an Ethernet cable plugged into the back your iMac, and a working Internet connection. You should see a spinning globe on your iMac's screen, and a message about "Starting Internet Recovery, this may take a while", and then let it continue.
From there, assuming it was successful, you should be able to access Disk Utility, and then make sure that your External Hard Disk is formatted properly: 1 partition, MacOS Journaled (extended), boot drive, and GUID on. Then you can Re-install the OS.
Again, I don't know if you had a backup done or a backup system in place and working, I hope so---otherwise you could be hooped.
I suppose, seeing as how your internal hard drive has failed, and was unable to be revived/fixed, that you might want to get that
taken care of. Unfortunately, it's not free. Usually, hard drives can and do fail, not often, but always with not much warning. Usually you can check it with Disk Utility, and it'll tell you its health/SMART status. 'tis a sad fact of life, but it's true.
There are some problems with the internal hard drive that Disk Utility cannot fix sometimes , which would mean buying something to deal with that, including data recovery.
anyways, good luck to you
john b