The fastest way to do this is with variables.
select sum(data)
from (select t.*, (@rn := @rn + 1) as rn
from table t cross join
(select @rn := -1) const
) t
group by rn div 3;
You should really have a column that specifies the ordering of the rows, so the subquery would have an order by <ordering column>
to ensure consistent results.