<% if @event.races_with_results.many? %>
<div class="event_info">
  <table class="event_races">
    <tbody>
      <%- @event.races_with_results.sort.each do |race| -%>
      <tr>
        <td class="race">
          <%= link_to race.name, "#race_#{race.id}" %>
        </td>
      </tr>
      <%- end -%>
    </tbody>
  </table>
</div>
<%- end -%>

<% if races.select(&:results_present?).many? %>
<div class="event_info">
  <table class="event_races">
    <tbody>
      <%- races.select(&:results_present?).sort.each_row do |first_race, second_race| -%>
      <tr>
        <td class="race">
          <%= link_to race.name, "#race_#{race.id}" %>
        </td>
      </tr>
      <%- end -%>
    </tbody>
  </table>
</div>
<%- end -%>

Use local variable races, not @event.races
Use local variable races, not @event.races
