Here's how I would design such a function systematically using parts of the Design Recipe from How to Design Programs.
The input is a list that may contain numbers and lists of numbers. For now I'll assume lists can be nested further than that. With arbitrarily-nested lists allowed, that would make the input a tree of numbers, not just a list.
;; A NumTree is one of:
;; - Number
;; - [Listof NumTree]
;; sum : NumTree -> Number
(define (sum nt)
???)
The "one of" in the data definition above means the function should use a conditional, with a question for each bullet in the "one of".
;; sum : NumTree -> Number
(define (sum nt)
(cond [(number? nt) ???]
[(list? nt) ???]))
The aren't any "sub-parts" in the cases of the data definition, so the next step is finding the references to complex data definitions, including self-references, and inserting helper functions for those. [Listof NumTree] is a complex data definition, so make a helper function for summing that.
First add this function to your "wish list", you'll come back to it later.
;; sum-listofnumtree : [Listof NumTree] -> Number
(define (sum-listof-numtree lont)
???)
Now that it's in your wish list, use it to finish defining the rest of sum.
;; sum : NumTree -> Number
(define (sum nt)
(cond [(number? nt) nt]
[(list? nt) (sum-listof-numtree nt)]))
Now once that's done go back to your wish list and work on sum-listof-numtree. Again you can base it on the data definition, this time for Listof.
;; A [Listof NumTree] is one of:
;; - '()
;; - (cons NumTree [Listof NumTree])
;; sum-listofnumtree : [Listof NumTree] -> Number
(define (sum-listof-numtree lont)
???)
Again the "one of" turns into a cond, with a branch for each bullet point.
;; sum-listofnumtree : [Listof NumTree] -> Number
(define (sum-listof-numtree lont)
(cond [(empty? lont) ???]
[(cons? lont) ???]))
Here, the cons case has two sub-parts, the first and the rest.
;; sum-listofnumtree : [Listof NumTree] -> Number
(define (sum-listof-numtree lont)
(cond [(empty? lont) ???]
[(cons? lont) (.... (first lont) (rest lont) ....)]))
The next step is seeing whether any of the sub-parts are complex data definitions, and if they are, inserting helper functions. In this case both are complex data. (first lont) is a NumTree and (rest lont) is a [Listof NumTree].
The "helper" function for NumTree here is sum, so in the template you can use (sum (first lont)). And the "helper" function for [Listof NumTree] is sum-listof-numtree, so you can use (sum-listof-numtree (rest lont)) for that.
;; sum-listofnumtree : [Listof NumTree] -> Number
(define (sum-listof-numtree lont)
(cond [(empty? lont) ???]
[(cons? lont) (.... (sum (first lont)) (sum-listof-numtree (rest lont)) ....)]))
Now just fill in the holes with what makes sense for summing.
;; sum-listofnumtree : [Listof NumTree] -> Number
(define (sum-listof-numtree lont)
(cond [(empty? lont) 0]
[(cons? lont) (+ (sum (first lont)) (sum-listof-numtree (rest lont)))]))
Combined, these form a pair of mutually recursive functions, operating on a pair of mutually recursive data definitions.
;; A NumTree is one of:
;; - Number
;; - [Listof NumTree]
;; A [Listof NumTree] is one of:
;; - '()
;; - (cons NumTree [Listof NumTree])
;; sum : NumTree -> Number
(define (sum nt)
(cond [(number? nt) nt]
[(list? nt) (sum-listof-numtree nt)]))
;; sum-listofnumtree : [Listof NumTree] -> Number
(define (sum-listof-numtree lont)
(cond [(empty? lont) 0]
[(cons? lont) (+ (sum (first lont)) (sum-listof-numtree (rest lont)))]))