A knot in the solid torus and a Mazur manifold Part 1: The following picture is from Saveliev's book Lectures on Topology of 3-manifolds, page 130:

He indicates that the knot drawn in the solid torus $S^1 \times D^2$ is homologous to $S^1 \times \{ 0\} \subset S^1 \times D^2$.
How can we prove such a claim? Do we know the classification of null-homologous knots in $S^1 \times D^2$?
Part 2: To obtain a Mazur manifold $W$, he says that we attach a $2$-handle to $S^1 \times D^3$ (the dotted circle) with framing $3$. Diagrammatically, we have:

If the knot is not null-homologous, where does the framing $3$ come from?
 A: Two knots in the solid torus $U = S^1 \times D^2$ are homologous if and only if they have the same (signed) winding number.  Proving this boils down to computing the first homology group $H_1(U, \mathbb{Z})$.
For a given oriented knot $K$, its winding number can be computed by (a) finding an oriented meridian disk $D$ for $U$ which is transverse to $K$ and then (b) computing the algebraic intersection number of $K$ and $D$.
Finally you ask: "Do we know the classification of null-homologous knots in $S^1 \times D^2$?"  Well, there is a (very complicated) algorithm that decides if two null-homologous knots in $U$ are isotopic.  Using this we could produce the (infinite) list of all such knots (said list being complete and without repeats).

where does the framing 3 come from?

I'll guess that he means either (a) the blackboard framing for $K$ or (b) the framing coming from the surface that $K$ and $S^1 \times \{0\}$ cobound. Luckily, these are the same in this particular case.
A: As @MarcoGolla mentioned, the framing can be controlled due to Akbulut's carving technology: a dotted circle notation. It was introduced in the following article:

Akbulut, Selman. "On 2-dimensional homology classes of 4-manifolds." Mathematical Proceedings of the Cambridge Philosophical Society. Vol. 82. No. 1. Cambridge University Press, 1977.

Let $U$ be the unknot in $S^3$ and $D_U$ be the ribbon disk in $B^4$ with $\partial D_U = U$. Observe that $S^1 \times B^3$ is the ribbon disk exterior of $D_U$, i.e., it is diffeomorphic to $B^4 \setminus \nu(D_U)$ where $\nu(D_U) \approx D_U \times B^2$.
Consider a ribbon knot with a ribbon disk $(K,D) \subset (S^3,B^4)$. Similarly, one can try to understand the $4$-manifold $B^4 \setminus \nu(D)$. The procedure of the construction of the Kirby diagram was answered, for instance here.
Once it is understood, one can also put a dot on the ribbon disk exterior. The reference is again Akbulut's book Section 1.1 and 1.4 about carving ribbon disks:

Akbulut, Selman. 4-manifolds. Vol. 25. Oxford University Press, 2016.

It equivalently represents the ribbon disk exterior. See again Exercise 1.10 and Figure 1.22 in Akbulut's book.
