One major purposefunction of grease on bikes is waterproofing, e.g. for bearings. Since the bearings on a bike typically move slowly (no more than a few hundred rpm for hub bearings and significantly slower for everything else) you should pack them with quite a bit of grease to provide the best protection from ingress of water and dirt.
It's also a good idea to apply grease to threads that will bear a lot of torque – it prevents seizing, and can save you a lot of grief when you need to undo it years later.
Examples of where this is a good idea Examples are the pedal threads and bottom bracket threads, both of which must be highly torqued but are very exposed to dirt and water and dirt kicked up by the front wheel.