Special occasion speeches are, to put it lightly, the "life of the party" when it comes to public speaking. Farewells, toasts, and after dinner remarks are often the lightest of public speaking fare, requiring little in preparation or execution. Humor, anecdote, and brevity are notable qualities of these types of speeches. Still, like any public speaking experience, it helps to be familiar with your subject and able to prepare, even if briefly beforehand.
Many times, these speeches are not written extensively prior to the speaking engagement. You may jot down a few key talking points or maybe a specific joke or anecdote that you wish to include.
Like preparing for any speech, regardless of formality, consider the audience, venue, and occasion for which you're speaking. It's also particularly helpful, especially for wedding toasts, to consider the span of ages in the room. If there is a particularly older or younger crowd, you may need to tailor your material accordingly so that all audience members can relate.
Many times, farewells, toasts, and after dinner speeches are made in honor or in celebration of someone else: a guest or guests of honor, or perhaps the event host or hostess themselves. While it's acceptable to poke fun, make sure you do so in a way that's kind and not cruel. Unless you're specifically giving remarks for a full on roast, you shouldn't overly embarrass your guest of honor. You're there to entertain, not humiliate.
It's important to remember that brevity is your friend in all of these situations: no one likes a toast that goes on forever while the champagne bubbles go flat. To quote Esenwein and Carnagey, authors of The Art of Public Speaking:
Blessed is the man that maketh short speeches, for he shall be invited to speak again.