Below is actually everything that is needed to answer this question.
FILTER can take an array as its first argument. The tricky part is that every element of that array must have the same dimensions. While A2:A4 is a 3x1 range, SUM(1,3) is a 1x1 range. But this can be solved by multiplying SUM(1,3) by a sort of placeholder 3x1 array: ROW(A2:A4)^0. Since every element in A2:A4 has a row number, and any number to the zero power (^0) is 1, this just signals Google Sheets to give you SUM(1,3) "multiplied by 1 for three rows. And that makes the two elements of that curly-bracket array match up with everything else.