Ray-tracing has found important applications in the analysis of optical systems. In this work, a special modification of the ray-tracing method is applied to the analysis of several different micro-optical structures, used as probes for refractive index measurements, with the aim of obtaining the structure that is practical and acceptable from the technological point of view. The structure which is studied here is a small size solid retroreflector of special shape and complex inner constitution. It serves to couple together a pair of optical fibers. One of these fibers is connected to the light source, the other one to the photometer. The operation of this structure as the refractometric sensor is based on the frustrated total internal reflection in the retroreflector, which is formed by the structure's surface. Therefore, the structure's internal reflectivity depends on the refractive index of the surrounding media. This media may be either a gas or a fluid. By use of this structure, the refractive index of the surrounding media can be determined, and the type of the particular fluid may be disclosed. However, for better performance, the sensor's shape has to be optimized taking into consideration the particular parameters of the optical elements and materials used for the sensor, and the refractive index value of the particular fluid. Because of some singularities of the problem, the special ray-tracing algorithm has been developed for the analysis of this structure. This algorithm has proved to be effective for the theoretical optimization of the structure used as refractometric optical sensor.