The most important thing is to make it clear that everyone will be missed and that it has been really good to know them. Otherwise there are different kinds of farewell speech and the wording will also depend on the ages of the people present, whether it is a work or another situation etc. There are some very good tips and an overview here.