class() is used to define/identify what "type" an object is from the point of view of object-oriented programming in R. So for
> x <- 1:3
any generic function that has an "integer" method will be used.
typeof() gives the "type" of object from R's point of view, whilst
mode() gives the "type" of object from the point of view of Becker, Chambers & Wilks (1988). The latter may be more compatible with other S implementations according to the R Language Definition manual.
I'd probably err on the side of using
typeof() in most cases unless it was for passing R objects to compiled code, where
storage.mode() will be useful.
This is usefully discussed in the R Language Definition as linked to above.