However, in your case the numbers get to big to be represented as integer, so the coercion to double does the trick, since double can store larger numbers. A more explicit way to state what you are doing would be to do sum(as.numeric(pop)). You should have gotten a "integer overflow" warning when you run your code.
What's been said gets the problem and solution, but to lay out the process to figure that out, look at that other tab of output from the code chunk, which contains a bunch of warnings:
library(dplyr)
gapminder::gapminder %>%
group_by(year) %>%
summarise(pop = sum(pop))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> Warning in summarise_impl(.data, dots): integer overflow - use sum(as.numeric(.))
#> # A tibble: 12 x 2
#> year pop
#> <int> <int>
#> 1 1952 NA
#> 2 1957 NA
#> 3 1962 NA
#> 4 1967 NA
#> 5 1972 NA
#> 6 1977 NA
#> 7 1982 NA
#> 8 1987 NA
#> 9 1992 NA
#> 10 1997 NA
#> 11 2002 NA
#> 12 2007 NA
As it happens, they're pretty good warnings that say what's happening: the result of sum is a larger integer than the machine can handle. The limit—about 2.1 billion—is stored in .Machine$integer.max:
.Machine$integer.max
#> [1] 2147483647
The warnings also tells how to avoid integer overflow: coerce to numeric. Doing so shows that the world population for all these years is, in fact, above 2.1 billion: