Most likely you have encountered this in work involving Shakespeare, and he used soliloquy to great dramatic effect. A soliloquy is a type of aside. Asides are speeches that are given by characters directly to the audience, usually not to be heard by other characters on or off stage.
A soliloquy specifically is a monlogue and is an insight into a characters thoughts and feelings, whether this is being said to the audience directly or we are simply allowed to view them varies from play to play. To understand soliloquy (or anything in dramatic form) more clearly it is always useful to view rather than read about them. I would reccomend watching David Tennant's soliloquy from Hamlet - the famous "to be or not to be" speech.