I've written before about testimony – what we know and how we know it. Of course when we say we know, it is often not in the empirical sense, but in the sense of knowing as any jury might know something – based on the credibility of witnesses. There is a key difference in testimony, however. The scriptures repeatedly report that the Spirit can bear witness (as the Holy Ghost did at Jesus' baptism, for instance).
Modern revelation is even clearer on the subject as Joseph Smith and others testified of seeing heavenly messengers and witnessing miraculous events. Of course the witnessing of miraculous events is not limited to Latter-day Saints. Faithful people throughout the ages have attributed outcomes to God's merciful intervention in their lives.
A commenter raised a question the other day about that verse in Alma 32 which suggests that desire is the first step to faith, and that faith is an early step on the path to knowledge. Alma suggests desiring to know will lead us to put something to the test, to exercise faith, and that over time we will come to know. We teach of children this works with keeping the commandments, and realizing the blessings of the Lord. (Of course the Savior also taught this principle when he said "If any man will do his will he will know of the doctrine whether it be of God or whether I speak of myself" (John 7:17).) If we faithfully keep the commandments, we will sooner or later sense the blessing of those commandments in our lives. This has certainly been my experience.
James 1:5-6 suggests if we pray in faith, "nothing wavering", then we will receive assurance from the Lord. Some have cynically suggested that such "praying in faith" simply predisposes us to assume any presumed response is an answer to our prayer. While I can understand that argument, it's not my personal experience. And that is primarily because for me, answers to my questions in prayers rarely have come at the time I've prayed. Instead, the answer may come days or months or even years later, often triggered by independent circumstances.
A case in point: in my early college years, I had, like many students who really start studying church history, some specific questions that I hadn't been able to resolve in my mind. I had no issue with the Book of Mormon or even with the First Vision. I was confident that priesthood was restored through Joseph, but I wondered about later choices he made, presumably under inspiration.
I followed some advice I had received at the time to cling to what I knew (or believed) and to wait patiently for answers to these other questions. For some time I fervently prayed for resolution and none came, but I did continue to have that sweet confirmation of the spirit that the basic teachings of the church (and of Joseph) were true.
Years later (like 15 years later) I was teaching Church History and the Doctrine and Covenants in Sunday School. And in preparation for a particular lesson, I read passages in the Doctrine and Covenants that I had read many times before (by then I had taught Gospel Doctrine repeatedly, and even had taught Church History one year in seminary). All at once, as I read several particular passages, I felt my concerns fade away. It was like Enos' experience in which he felt his guilt was "swept away". There was a logical response to my question in what I read, and there also came the confirming witness of the Holy Ghost that this logical response was correct.
I don't know why it took me so long to resolve the matter. Looking back, it should have been plain to me much sooner, but for whatever reason it wasn't. In some ways, I'm glad it wasn't, because it gave me a chance to exercise my faith, understanding what I knew, and recognizing that I didn't know everything.
Of course these things of the Spirit are difficult to describe in specific terms: they are personal, and individuals are likely to see things differently, if for no other reason than because we have different gifts and different life experiences.