In the context of United States elections, various methods are used by candidates to secure votes. One such method is through the selection of delegates during the primaries and caucuses. What is the primary purpose of these events in the electoral process?