Use backtracking. For each element, decide whether to include it or not.
Start with an empty subset. At index , either add nums[i] and recurse, or skip it and recurse. When you reach the end of the array, add the current subset to results.
Alternatively: iterate through elements. At each step, for every existing subset, create a new subset by adding the current element.
Both approaches generate all subsets.