We consider a secondary user (SU) with energy harvesting capability. We design access schemes for the SU which incorporate random spectrum sensing and random access, and which make use of the primary automatic repeat request (ARQ) feedback. We study two problem-formulations. In the first problem-formulation, we characterize the stability region of the proposed schemes. The sensing and access probabilities are obtained such that the secondary throughput is maximized under the constraints that both the primary and secondary queues are stable. Whereas in the second problem-formulation, the sensing and access probabilities are obtained such that the secondary throughput is maximized under the stability of the primary queue and that the primary queueing delay is kept lower than a specified value needed to guarantee a certain quality of service (QoS) for the primary user (PU). We consider spectrum sensing errors and assume multipacket reception (MPR) capabilities. Numerical results show the enhanced performance of our proposed systems.