Why does DFS(G, v) visit the whole connected component of v, and why do its discovery edges form a spanning tree of that component?
Whenever DFS visits a vertex it examines all of that vertex's edges, so it cannot miss a neighbour of a visited vertex, and step by step it reaches everything connected to v. Each vertex except v is entered through exactly one discovery edge, so a component with k vertices gets k − 1 discovery edges, all linked back to v; a connected graph on k vertices with k − 1 edges is a tree.
Everything reachable is visited. Suppose some vertex u of v's component were missed. Take a path from v to u and the first vertex on it that DFS missed. The vertex before it on the path was visited, so DFS examined all of its edges, including the one to the missed vertex, and would have visited that vertex then. So no vertex of the component is missed.
The discovery edges form a spanning tree. A discovery edge always leads from a visited vertex to a new one, so every vertex except v has exactly one: the edge it was discovered through. Following these edges backwards from any vertex climbs from each vertex to the one that discovered it and ends at v, so they connect the whole component. They are k − 1 edges connecting k vertices, and a connected graph with one edge fewer than vertices contains no cycle: a spanning tree.
The tree is not unique. A different start vertex or a different order of the incident edges gives a different DFS tree, but every one of them has k − 1 edges.